PDA

View Full Version : Disable Back and Next Buttons



gwthompson
5 Jul 2010, 2:49 PM
Hi,

I am using the following toolbar for a panel that uses a card layout:



dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
items: [{
text: 'Previous',
ui: 'back',
handler: function() {
mainPanel.layout.prev({
type: 'slide',
direction: 'right'
}, false); // true to wrap.
}
}, {xtype: 'spacer'}, {
text: 'Next',
ui: 'forward',
handler: function() {
mainPanel.layout.next({
type: 'slide',
direction: 'left'
}, false);
}
}]
}]


Is there any way to disable the Next button if I've reached the last card in my panel's items and re-enable it when I tap the back button? I'd like to do the same thing with the Previous button with it starting out disabled and then becoming enabled when the Next button is tapped.

Thanks for all of your help as always!

gt

TommyMaintz
6 Jul 2010, 9:50 AM
You could listen for the cardswitch event, check the index of the card, and call disable and enable on the back and forward buttons accordingly.