1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    KevinHanson is on a distinguished road

      0  

    Default Forcing SubSort on click of Grid header?

    Forcing SubSort on click of Grid header?


    I'm new to ExtJs, so forgive me if I don't have all the jargon down.

    I've got a grid (Ext.grid.Panel) and want the columns to be sortable. Simple enough. However, one of the columns is a date column, and no matter what column the user clicks on, I want to FORCE a sub-sort on the date column.

    For instance: If I click on the "name" column, it sorts the grid by name, ascending. But I want to make it sort by name asc / date desc.

    I've tried numerous ideas I've found online, and I've come close, but nothing seems to work exactly. If I intercept the headerclick event and call grid.sort() manually, it either is ignoring my call, or is re-sorting by the just the single clicked column after my call.

    If I set sortable to false, I can still call the sort in the headerclick event, but then I lose the visible sort direction triangle in the header row (which I still want).

    Can anyone help?? I'm getting desperate! Thanks.

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


    Using the UI, it's only going to be single 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 Premium Member
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    KevinHanson is on a distinguished road

      0  

    Default Working now

    Working now


    Actually, I figured it out. In a nutshell, I overrode the doSort method for each column I defined with a function that does the sort with my extra sorter (subsort column) tacked on.

    for instance, for my first column, called "Poster", if the user clicks the header, this happens:

    Code:
    doSort: function (state) {           
                     var g = this.up('grid');
                     var ds = g.store;
                     ds.sort([{
                                 property: 'Poster',
                                 direction: state
                     }, {             
                                 property: 'Date',
                                 direction: 'DESC'
                     }]);
    },
    It sorts by "Poster" in whatever the current direction should be, AND subsorts by the "Date" column descending.

    I'll try to put together a simple example on jsFiddle.net when I get a chance and share it here. Hopefully this will help others.

Thread Participants: 1

Tags for this Thread

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