Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

Threaded View

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    67
    Answers
    3
    Vote Rating
    1
    Soenhay is on a distinguished road

      0  

    Default Answered: How to group a list but change the group order...

    Answered: How to group a list but change the group order...


    Hi,

    I am wondering if it is possible to change the order of a grouped list. For example:

    Code:
    Ext.define('a.store.S', {
        extend: 'Ext.data.Store',
        config:
        {
            model: 'a.model.S',
            grouper: {
                groupFn: function (record) {
                    return record.get('group').substr(2);
                }
            },
    
            data: [ 
                  {title: 'a title', group: '2-A group', url: 'some url'},
                  {title: 'b title', group: '2-A group', url: 'some url'},
                  {title: 'c title', group: '1-B group', url: 'some url'},
                  {title: 'd title', group: '1-B group', url: 'some url'},
                  {title: 'e title', group: '0-C group', url: 'some url'},
            ]
    This list will be grouped by the group field but the order of the groups would be as follows:
    A group
    B group
    C group

    If I do not use the substr method then the groups would be in the order that I desire but with the undesirable prefix:
    0-C group
    1-B group
    2-A group


    Is it possible to make the groups in this list ordered and displayed as follows?
    C group
    B group
    A group

  2. Thanks to j.k's response:
    j.k
    You can use sortProperty or sorterFn to sort your groups in any order you want to:

    http://docs.sencha.com/touch/2-0/#!/...t.util.Grouper
    I found this link:

    http://www.sencha.com/forum/showthre...e-in-ST2-beta1

    Which lead to this solution:

    Code:
    Ext.define('a.store.S', {
    extend: 'Ext.data.Store',
    config:
    {
        model: 'a.model.S',
        autoLoad: true,
        sorters: 'title',
        grouper: {
            sortProperty: 'group_index',
            groupFn: function (record) {
                return record.get('group_title');
            }
        },
        data: [
            {title: 'a title', group_title: 'A group', group_index: '1'},
            {title: 'b title', group_title: 'A group', group_index: '1'},
            {title: 'c title', group_title: 'B group', group_index: '2'},
            {title: 'd title', group_title: 'B group', group_index: '2'},
            {title: 'e title', group_title: 'C group', group_index: '0'},
        ]
    }
    Which will make the groups with the following titles and order:
    C group
    ---e title
    A group
    ---a title
    ---b title
    B group
    ---c title
    ---d title

    I changed the order from my original post to make it more clear.

Thread Participants: 1