1. #1
    Sencha User
    Join Date
    May 2008
    Posts
    262
    Vote Rating
    -4
    mnask79 is infamous around these parts

      0  

    Default resort grid

    resort grid


    hi guys ,

    i have grid , and the json for this grid autoload every 30 sec's
    i sort the records depend on the the price field ...

    so i want when i load the json data again re asort the grid records

    i mean forexample

    first time when i load the json data the grid is

    price f2 f 3
    3,1 - -
    2,9 - -
    2,2 - -


    when i load the json again maybe the prices will change

    so i get like this

    price
    2,8
    3,5
    2,2

    i hope u got me ,,, i want to re sort my grid depend on the price
    thanks

  2. #2
    Ext User
    Join Date
    Feb 2008
    Posts
    39
    Vote Rating
    0
    treqx is on a distinguished road

      0  

    Default


    Adding a sortInfo config option to your store should do the trick:

    Code:
        var yourStore = new Ext.data.JsonStore({
            sortInfo : {
                field : 'price',
                direction : "DESC"
            },
            etc...

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    78
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    for best performance, you should sort on the server side before the data is sent to the interface.

  4. #4
    Sencha User
    Join Date
    May 2008
    Posts
    262
    Vote Rating
    -4
    mnask79 is infamous around these parts

      0  

    Default


    i sort it at server side , but when i recall the the proxy page i get the data with different values ,so i want to re sort the grid records depend on the new data values

    got me ?

    thanks alot

  5. #5
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    78
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    No i dont it seems like a waste to sort again on the client side.

  6. #6
    Sencha User
    Join Date
    May 2008
    Posts
    262
    Vote Rating
    -4
    mnask79 is infamous around these parts

      0  

    Default


    yes , that's right ..i want to re sort the grid in client side
    coz i call my proxy every 30 sec's and i get new json data so i want to re sort the rows in data grid

  7. #7
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    78
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    hook a listener into the 'load' event of the datastore, then call sort.

Thread Participants: 2