1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    São Paulo - SP
    Posts
    22
    Vote Rating
    0
    maps_tecnologia is on a distinguished road

      0  

    Default Unanswered: Sorting Tree Grid that shows OBJECTS.

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,220
    Answers
    3521
    Vote Rating
    859
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    São Paulo - SP
    Posts
    22
    Vote Rating
    0
    maps_tecnologia is on a distinguished road

      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

Thread Participants: 1