1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    177
    Vote Rating
    0
    mcadirci is on a distinguished road

      0  

    Question How to handle grid sortchange?

    How to handle grid sortchange?


    Hello,

    I am using beta2.

    I want to handle grid column sort events but I can't figure how to do this. I can't add sortchange events to columns.

    Api doc doesn't seem like updated.

    Any idea will be great.

    Thanks.
    --
    Mehmet Çadırcı

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,755
    Vote Rating
    828
    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


    Tried the datachanged event on the Store? This should fire when loaded, model data updated, model add, model remove, filter, sort...
    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
    Aug 2010
    Posts
    177
    Vote Rating
    0
    mcadirci is on a distinguished road

      0  

    Default


    Hello again,

    Thanks for your answer. The datachanged event fires on load and sort change. How can I find which column is sorted?

    Thanks again.
    --
    Mehmet Çadırcı

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,755
    Vote Rating
    828
    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


    Actually, each Column is suppose to fire the sortchange event, that would be more of what you are looking for.
    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.

  5. #5
    Sencha User
    Join Date
    Aug 2010
    Posts
    177
    Vote Rating
    0
    mcadirci is on a distinguished road

      0  

    Default


    Thanks for your answer.

    Well I have many rows and instead of displaying all of them (which is slow) at once I made a client side paging.

    I have implemented next page, prev page and jump to page.

    But of course I need "column sort" effect all my data. At the moment I am looking for a way to sort all data before sort and display the correct data to user.

    I need a event like before sort, which has some info about the triggered column and the sort (asc or desc).

    Thanks for your help.
    --
    Mehmet Çadırcı

  6. #6
    Sencha User
    Join Date
    Aug 2010
    Posts
    177
    Vote Rating
    0
    mcadirci is on a distinguished road

      0  

    Default


    ++ i can't manage to add the sortchange event (it doesn't fire)
    PHP Code:
    columns        : [
                      
    //{text:'',dataIndex:'index', hideable: false, width:30, align: 'right'},
                      
    {text:'Plaka',dataIndex:'plate'
                             
    listeners:{
                                  
    sortchange:{
                                        
    fn:function(){
                                              
    alert('ab');
                                        }
                                  }
                             }
                      },
                      {
    text:'Zaman',dataIndex:'time',renderer:tr.com.mobiliz.utils.formatDateHourwidth110},
                      {
    text:'Trailer',dataIndex:'trailer',hidden:true},
                      {
    text:'Driver',dataIndex:'driver',hidden:true},
                      {
    text'Adres'dataIndex:'address',flex1},
                      {
    text'Sefer'dataIndex:'trip',hidden:true},
                      {
    text'Hız'dataIndex:'speed',renderer:_activityDetailUtil.renderSpeed,align:'center'},
                      {
    text'Yol'dataIndex:'distance',renderer_activityDetailUtil.renderDistancealign:'center'},
                      {
    text'İleti'dataIndex:'message'},
                      {
    text'Gönderen'dataIndex'sender'}]
    }; 
    This is my grids columns. Is there any thing wrong about this?
    --
    Mehmet Çadırcı

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,755
    Vote Rating
    828
    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


    You can enable remoteSort on the Store if you want the backend to take care of the sorting (same with filtering).

    Digging into the source, looks like HeaderContainer actually has the sortchange event. Each Column gets the HeaderContainer and fires the event on it.
    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.

  8. #8
    Sencha User
    Join Date
    Aug 2010
    Posts
    177
    Vote Rating
    0
    mcadirci is on a distinguished road

      0  

    Default


    Can you please give me a small sample?

    The grid can't be rendered without columns. I am a little confused about this.

    Thank you very much for your interest and patience.
    --
    Mehmet Çadırcı

  9. #9
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,755
    Vote Rating
    828
    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


    After render you can do this:

    Code:
    grid.down('.headercontainer').on('sortchange', function() {
        console.log('hi');
    });
    Tested and it did fire.
    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.

  10. #10
    Sencha User
    Join Date
    Aug 2010
    Posts
    177
    Vote Rating
    0
    mcadirci is on a distinguished road

      0  

    Default


    Thank you very much for your answer.

    It works great.
    --
    Mehmet Çadırcı

Similar Threads

  1. Best way to handle removal of rows in a grid
    By omermx in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 17 Nov 2009, 9:24 AM
  2. [SOLVED] GridPanel's sortChange event only fires once
    By misch331 in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 30 Jun 2009, 11:02 AM
  3. [FIXED] [1.1.3]Grid only fires SortChange event once
    By sbarkdull in forum Ext GWT: Bugs (1.x)
    Replies: 4
    Last Post: 29 Jun 2009, 5:56 AM
  4. BEFORE sortchange
    By heidtmare in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 6 Nov 2008, 7:49 AM
  5. Handle set pageSize parameter of the grid from outside
    By Denix in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 24 Jan 2008, 3:06 PM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi