Home > DeveloperSection > Forums > Sencha Touch 2.0 — How can I hide my list item?
Hugh Jackman
Hugh Jackman

Total Post:52

Points:366
Posted on    May-31-2013 2:00 AM

 Sencha Touch Sencha Touch 
Ratings:


 1 Reply(s)
 2008  View(s)
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! 


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    June-01-2013 1:19 AM

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.


Don't want to miss updates? Please click the below button!

Follow MindStick