SENCHA TOUCH 2.0 — HOW CAN I HIDE MY LIST ITEM?

Hugh Jackman

Total Post:52

Points:366
Posted by  Hugh Jackman
 2442  View(s)
Ratings:
Rate this:
Hi Expert! 

Given a list and a segmentedButton in my panel's items:
[{
    xtype:'segmentedbutton',
    id:'segmented-btn',
    items: [{
        ui:'action',
        text: 'A',
        pressed: true
    },{
        ui:'action',
        text: 'B',
    }]
},{
    xtype: 'list',
    id: 'toList',
    scrollable: false,
    data: [],
    itemTpl: ['<div id="{title}-item">{title}</div>']
},{
    xtype: 'list',
    id: 'fromList',
    ui: 'round',
    data: [],
    itemTpl: ['<div id="{title}-item">{title}</div>']
}]

When the segmented button A is pressed, the 'To' list item will be hidden and when my segmented button B is pressed, the 'From' list item will be hidden and the 'To' list item will shown.

Thanks in advance! 
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Sencha Touch 2.0 — How can I hide my list item?

    Hi Hugh,

    Adding a listener function to the segmented button

    listeners: {
        toggle: function(container, button, pressed){
            if(button.text == 'A'){
                this.down('#fromList').show();
                this.down('#toList').hide();
            } else {
                this.down('#fromList').hide();
                this.down('#toList').show();
            }
        }
    }
    Should work if the handler function doesn't.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!