Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Sorting in a Grid

  1. #11
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    St. Helens, England
    Posts
    30

    Default

    Hey, yup, I added a few different listeners. Interestingly, when remoteSort was set to true the "sortchange" listener was not firing when the column headers were clicked. That is about all the potentially useful information I gleaned from that unfortunately.

  2. #12
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    Hmm. I just would have added all the listeners for the grid. Then taken note of any differences in the stack trace (maybe put console.trace() in the various pertinent listeners) when the sorting worked and did not work to figure out at what point things changed.

  3. #13
    Ext JS Premium Member
    Join Date
    Apr 2008
    Posts
    3

    Default

    I think I may be encountering the same issue that you are...

    I'm currently using the LiveGrid component which extends the JsonReader. If I pass the metaData through the JSON request, as you are doing, sort is broken just like you. If I do not pass the metaData, and define the fields when I create the BufferedJsonReader, everything works fine. Also, if I define the fields when I create the reader *and* pass the metaData, it breaks it too.

    Have you tried not passing the metaData through the JSON request and just defining it when you create the JsonReader?

    I'm trying to figure out what causes it to break when passing the metaData, but haven't found anything yet. It would be really nice to be able to do that for sure.

  4. #14

    Default

    when you're passing the metaData do you still see the records?
    are you using the override/fix in http://extjs.com/forum/showthread.php?t=27835?

  5. #15
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    St. Helens, England
    Posts
    30

    Default

    Although now that 2.1 is out you don't need the fix (providing of course you use 2.1).

  6. #16
    Ext User
    Join Date
    Dec 2007
    Posts
    21

    Default

    Hi,

    I'm using Ext 2.1 but I'm still seeing this problem where dir=ASC is sent to server everytime when I pass the metaData in the JSON response.

    What is the fix? I see the override in the other thread has been added to the JsonReader code but it doesn't work for me.

    My store looks like:

    Code:
    var assetStore = new Ext.data.Store({
            proxy: new Ext.data.HttpProxy({
                method:'GET',
                 url:'/api/asset/assets/',
                disableCaching:false,
                headers: {'Accept': 'application/json'}
            }),
            reader: new Ext.data.JsonReader(),
            remoteSort: true
        });

  7. #17
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    St. Helens, England
    Posts
    30

    Default

    Hi Mpf,

    As of yet there isn't a fix for this particular sorting problem as it is still an outstanding issue with my code. I will get back to trying to figure out what the problem is with this soon but it doesn't seem to be a very common issue.

  8. #18
    Ext User
    Join Date
    Dec 2007
    Posts
    21

    Smile

    OK. I've found a work around. According to this bug http://extjs.com/forum/showthread.php?t=35948 , the Store is expecting sortInfo to be provided in the metaData. The work-around is to check if meta.sortInfo exists before overwriting it.

    Code:
    Ext.override(Ext.data.Store, {
        onMetaChange : function(meta, rtype, o){
            this.recordType = rtype;
            this.fields = rtype.prototype.fields;
            delete this.snapshot;
            // only overwrite sortInfo from meta if it exists
            if (meta.sortInfo) {
                this.sortInfo = meta.sortInfo;
            }
            this.modified = [];
            this.fireEvent('metachange', this, this.reader.meta);
        }
    });

  9. #19

    Default

    Woo!
    That works for me and Sparky!

    I really hope that that override can go into the next version of Ext.

  10. #20
    Ext JS Premium Member
    Join Date
    Nov 2007
    Location
    Munich
    Posts
    30

    Default

    Thx, this override solved my grid sorting problems too

Page 2 of 2 FirstFirst 12

Posting Permissions

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