PDA

View Full Version : [FIXED] SegmentedButton.add() not working on empty item list



jep
18 Sep 2011, 5:29 PM
Sencha Touch version tested:

1.1 rev 1

only default ext-all.css




Platform tested against:

iOS 4.3.5 (8L1)
Android 2.2.2
Chrome 14.0.835.163 (Windows XP)


Description:

SegmentedButton.add() only adds another sub-button if there is an existing one in the group.


Test Case:



Ext.setup({
onReady: function() {
pnl = new Ext.Panel({
fullscreen:true,
dockedItems:{
xtype:'toolbar',
dock:'top',
items:[
{
xtype:'segmentedbutton',
itemId:'segbutt1',
items:[{text:'Button 1'}]
},
{
xtype:'segmentedbutton',
itemId:'segbutt2',
items:[]
}
]
}
});

pnl.down('#segbutt1').add({text:'Button 2'});
pnl.down('#segbutt1').doLayout();

pnl.down('#segbutt2').add({text:'Button 3'});
pnl.down('#segbutt2').doLayout();
}
});


Steps to reproduce the problem:

Run the above code


The result that was expected:

There should two segmented buttons. The first should contain Button 1 and Button 2. The second should contain Button 3.


The result that occurs instead:

There is only one segmented button - the one containing Button 1 and Button 2.

jep
19 Sep 2011, 7:12 AM
Here's another problem that's probably rooted in the same code so I'm not creating a totally different problem report:



Ext.setup({
onReady: function() {
pnl = new Ext.Panel({
fullscreen:true,
dockedItems:{
xtype:'toolbar',
dock:'top',
items:[
{
xtype:'segmentedbutton',
itemId:'segbutt1',
items:[{text:'Button 1'}, {text:'Button 2'}, {text:'Button 3'}]
}
]
}
});

pnl.down('#segbutt1').items.removeAt(1);
pnl.down('#segbutt1').doLayout();
}
});

Note that Button 2 never really gets removed, though pnl.down('#segbutt1').items.length is 2 after this code runs. Button 2 functions abnormally, but is still there.

mike.estes
20 Sep 2011, 8:35 AM
Thank you for the excellent report and concise test case, bug confirmed, I've got this pushed into the system