1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    15
    Answers
    1
    Vote Rating
    0
    JeaffreyGilbert is on a distinguished road

      0  

    Question Unanswered: How to Apply Disclosure only to Certain Group(s)?

    Unanswered: How to Apply Disclosure only to Certain Group(s)?


    I currently have grouping like this:

    groups-disclosure.png
    Code:
    Code:
    Ext.regModel('Contact', {
                    fields: ['firstName', 'lastName']
                });
                
                var store = new Ext.data.JsonStore({
                    model  : 'Contact',
                    getGroupString : function(record) {
                        //return record.get('lastName')[0];
                        return record.get('group');
                    },
                    data: [
                        {firstName: 'Tung', lastName: 'Hauw', group: 'Parents'},
                        {firstName: 'Regina', lastName: 'Clarissa', group: 'Parents'},
                        {firstName: 'Melvin', lastName: 'Gilbert', group: 'Children'},
                        {firstName: 'Jeaffrey', lastName: 'Gilbert', group: 'Children'},
                        {firstName: 'Melissa', lastName: 'Merryl Gilbert', group: 'Children'},
                        {firstName: 'Jesica', lastName: 'Merryl Gilbert', group: 'Children'}
                    ]
                });
                
                var list1 = new Ext.List({
                    flex: 1,
                    cls: 'list_simple',
                    sorters: ['firstName', 'group'],
                    itemTpl: '{firstName} {lastName}',
                    grouped: true,
                    groupTpl : [
                        '<tpl for=".">',
                            '<div class="x-list-group x-group-{id}">',
                                '<h3 class="x-list-header"><div class="header">{group}</div></h3>',
                                '<div class="x-list-group-items">',
                                    '{items}',
                                '</div>',
                            '</div>',
                        '</tpl>'
                    ],
                    onItemDisclosure: function(record, btn, index) {
                        Ext.Msg.alert('Tap', 'Disclose more info for ' + record.get('firstName') + ' ' + record.get('lastName'), Ext.emptyFn);
                    },
                    store: store
                });
    I need to have specific disclosure for specific group. With my code above, I get all groups have the same disclosure. I'm trying to achieve this design:

    groups-disclosure-2.png
    No disclosure for Parent's items. If we slide on Parent's row, we will see Remove button. Also, it has tap event.

    I don't have idea where I should move/change the disclosure event. My first thought is hide the disclosure button on Parents by CSS, but I'm finding elegant way.

    Please also give me a clue to create tapping and sliding event for Parents' items (don't apply to Children's rows).

    Thanks in advance!

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Add a 'disclosure' field into your model, and set it to false in the records where you do not want it to show.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    15
    Answers
    1
    Vote Rating
    0
    JeaffreyGilbert is on a distinguished road

      0  

    Default


    Thanks for the reply. I tried with your direction but no changes. Did I miss something in the code?

    Code:
    Ext.regModel('Contact', {
        fields: ['firstName', 'lastName', 'disclosure'],
    });
                
    var store = new Ext.data.JsonStore({
        model  : 'Contact',
            getGroupString : function(record) {
            //return record.get('lastName')[0];
            return record.get('group');
        },
        data: [
            {firstName: 'Tung', lastName: 'Hauw', group: 'Parents', disclosure:false},
            {firstName: 'Regina', lastName: 'Clarissa', group: 'Parents', disclosure:false},
            {firstName: 'Melvin', lastName: 'Gilbert', group: 'Children'},
            {firstName: 'Jeaffrey', lastName: 'Gilbert', group: 'Children'},
            {firstName: 'Melissa', lastName: 'Merryl Gilbert', group: 'Children'},
            {firstName: 'Jesica', lastName: 'Merryl Gilbert', group: 'Children'}
        ]
    });
    
    var list1 = new Ext.List({
        flex: 1,
        cls: 'list_simple',
        sorters: ['firstName', 'group'],
        itemTpl: '{firstName} {lastName}',
        grouped: true,
        groupTpl : [
            '<tpl for=".">',
                '<div class="x-list-group x-group-{id}">',
                    '<h3 class="x-list-header"><div class="header">{group}</div></h3>',
                    '<div class="x-list-group-items">',
                        '{items}',
                    '</div>',
                '</div>',
            '</tpl>'
        ],
        onItemDisclosure: function(record, btn, index) {
            Ext.Msg.alert('Tap', 'Disclose more info for ' + record.get('firstName') + ' ' + record.get('lastName'), Ext.emptyFn);
        },
        store: store
    });

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