PDA

View Full Version : Panel with ButtonGroup and EnableTabScroll render problem



PranKe01
3 Dec 2009, 3:01 AM
Hi guys,

this isn't a question - it's more a hint or a bugreport.
When creating a Panel with a ButtonGroup where some buttons should not be visible, there is a problem with the EnableTabScroll property.

{
xtype: 'buttongroup',
columns: 2,
title: 'Should not be visible',
hidden: (rolleID == 1 || rolleID == 2 || rolleID == 3 || rolleID == 4 || rolleID == 6 ? true:false),
items: [{
text: 'Item1',
scale: 'large',
rowspan: 2,
iconCls: 'add',
iconAlign: 'top',
hidden: (rolleID == 8 ? true:false)
}, {
text: 'Item2',
scale: 'large',
rowspan: 2,
iconCls: 'add',
iconAlign: 'top',
width: 60
}]
}When starting this group is not visible. When resizing the window (making it smaller, so that the tabscrolling begins) the items are visible in the scroll-list! When making the window bigger again the buttons are visible!

I prevented both with this code:

{
xtype: 'buttongroup',
columns: 2,
title: 'Not visible for user 1 2 3 4 6',
hidden: (rolleID == 1 || rolleID == 2 || rolleID == 3 || rolleID == 4 || rolleID == 6 ? true:false),
listeners: {
'beforeshow': function(){ if(rolleID == 1 || rolleID == 2 || rolleID == 3 || rolleID == 4 || rolleID == 6) return false; },
'beforeadd': function(){ if(rolleID == 1 || rolleID == 2 || rolleID == 3 || rolleID == 4 || rolleID == 6) return false; }
},
items: [{
text: 'Item1',
scale: 'large',
rowspan: 2,
iconCls: 'add',
iconAlign: 'top',
hidden: (rolleID == 8 ? true:false),
listeners: {
'beforeshow': function(){ if(rolleID == 8) return false; },
'beforeadd': function(){ if(rolleID == 8) return false; }
}
}, {
text: 'Item2',
scale: 'large',
rowspan: 2,
iconCls: 'add',
iconAlign: 'top'
}]
}I also tried to use "beforerender" but that throws many errors when resizing the window. If there is a better (smaller) way to "remove" those buttons, please let me know :)

Best Regards!

PranKe01
22 Dec 2009, 2:42 PM
Does no one experienced the same problem?

PranKe01
6 Feb 2010, 9:53 AM
Okay - that is a pretty dirty way not showing the items. For now I use this code:


(rolleID == 1 || rolleID == 2 || rolleID == 3 || rolleID == 4 || rolleID == 6 ? '' : {
xtype: 'buttongroup',
columns: 2,
title: 'Should not be visible',
items: [(rolleID == 8 ? '' : {
text: 'Item1',
scale: 'large',
rowspan: 2,
iconCls: 'add',
iconAlign: 'top'
}), {
text: 'Item2',
scale: 'large',
rowspan: 2,
iconCls: 'add',
iconAlign: 'top',
width: 60
}]
})

I just got another problem. When I use an empty string when the item should not be visible, a little space appears in the menu. What must I insert for that case? I also tried null which throws an error, false which also throws an error and I tried {} which inserted an empty button to the menu...

Any hints?

PranKe01
13 Feb 2010, 4:46 AM
No ideas?

PranKe01
9 Mar 2010, 4:27 AM
*push*
How can I prevent an Item from rendering?