Results 1 to 3 of 3

Thread: Sorting Tree Grid that shows OBJECTS.

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    So Paulo - SP
    Posts
    22
    Vote Rating
    0
      0  

    Default Unanswered: Sorting Tree Grid that shows OBJECTS.

    Hello.

    I have a tree.Panel which store is populated by a dinamic json. Dinamic in the way that the data retrieved depends on user actions, so the columns my grid shows are dinamically configured.

    Basically I get an Object containing all the fields I have to show, and for each column I have:
    Code:
    renderer: function(cell) {
        return cell[Ext.Object.getKeys(value)[0]];
    },
    dataIndex: 'fullObject',
    Which translates to something like:
    Code:
    renderer: function(cell) {
        return fullObject.fieldName;
    },
    dataIndex: 'fullObject',
    That works fine, but I can't order the columns.
    I tought that maybe I had to provide the data types. which I did, but that doesnt seemed to work.

    This is one of the columns configuration:
    Code:
    [FONT='dejavu sans mono', monospace]
    [/FONT]
    Object
    
    • dataIndex: "fullObject"
    • renderer: function (cell) {
      • arguments: null
      • caller: null
      • length: 1
      • name: ""
      • prototype: Object
      • __proto__: function Empty() {}
    • sortable: true
    • text: "Quantity"
    • type: "number"
    • __proto__: Object
    [FONT='dejavu sans mono', monospace] [/FONT]

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      0  

    Default

    So the value in the field fullObject in the record is an object? You will need to specify sortType ont he fullObject field in your model that will do the sorting.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    So Paulo - SP
    Posts
    22
    Vote Rating
    0
      0  

    Default

    Something like this:

    Code:
    fullObject: {a:1, b:2, c: yadda }
    Then I go like:
    Code:
    column a        |  column b       |  column c
    fullObject.a    | fullObject.b    | fullObject.c
    Anyway, I am gonna look into that
    sortType.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •