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 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,553
    Answers
    3931
    Vote Rating
    1272
      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! Checkout the CODE tag!

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

  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
  •