1. #1
    Sencha User
    Join Date
    Dec 2009
    Posts
    364
    Vote Rating
    2
    raj_plays is on a distinguished road

      0  

    Default combo tpl

    combo tpl


    Hi,
    My combo has an item that is non selectable.
    To that item I need to apply a different class so that it looks disabled.
    I tried this with tpl but the code below duplicates the item. See attachment.
    Please help.
    Code:
    var typeCombo = new Ext.form.ComboBox({
        allowBlank: false,
        typeAhead: true,
        triggerAction: 'all',
        forceSelection: true,
        store: new Ext.data.XmlStore({
            url: 'CampaignService.asmx/getCampaignTypes',
            record: 'Table',
            fields: [{
                name: 'id',
                type: 'int'
            }, {
                name: 'name',
                type: 'string'
            }],
            autoLoad: true
        }),
        mode: 'local',
        displayField: 'name',
        valueField: 'id',
        listClass: 'x-combo-list-small',
        style: {
            float: 'left'
        },
        tpl: new Ext.XTemplate(
            '<tpl for=".">',
            '<tpl if="id == 0">',
            '<div class="x-combo-list-item-banned-true">{name}</div>',
            '</tpl>',
            '<div class="x-combo-list-item">{name}</div>',
            '</tpl>'),
        listeners: {
            beforeselect: function (combo1, record, index) {
    
    
                if (record.get('id') == 0) return false;
    
    
                return true;
            }
        }
    });
    Attached Images

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Yes, this is bound to happen, since you only have an if statement around the disabled option, but then put out the normal option immediately after for all...

  3. #3
    Sencha User
    Join Date
    Dec 2009
    Posts
    364
    Vote Rating
    2
    raj_plays is on a distinguished road

      0  

    Default


    Thank you, willigogs.
    I modified my code to
    Code:
    tpl: new Ext.XTemplate(
                        '<tpl for=".">',
                        '<tpl if="id == 0">',
                        '<div class="x-combo-list-item-banned-true">{name}</div>',
                        '</tpl>',
                        '<tpl if="id != 0">',
                        '<div class="x-combo-list-item">{name}</div>',
                        '</tpl>',
                        '</tpl>'
                    )
    Is it true that there is no else or else-if in tpl?

  4. #4
    Sencha User
    Join Date
    Dec 2009
    Posts
    364
    Vote Rating
    2
    raj_plays is on a distinguished road

      0  

    Default


    There is a problem with the code above.
    If I select any item in the combo, the item above it gets selected.
    If I remove the tpl config from the combo, this problem goes away.
    Please help. I need tpl to work properly.

Thread Participants: 1

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