PDA

View Full Version : Saving the state of a toolbar



Yemi
27 Aug 2013, 8:42 AM
I have a toolbar on top of my application. I also have two tab panels, the toolbar changes dynamic based on what is selected inside the first tab e.g. if I select a record in a grid, I want to be able to save this toolbar state such that when I navigate to another tab, I want to render the toolbar differently and going back to the previous tab display the toolbar the way it was before going to another. How can I achieve this ?

Yemi
28 Aug 2013, 4:16 AM
Any ideas please ?

willigogs
28 Aug 2013, 12:52 PM
The easiest solution would probably be two toolbars which you hide / show depending on what tab you're on :D

slemmon
29 Aug 2013, 8:18 AM
Hide / show two toolbars certainly seems valid.

You could also make use of removeAll.
http://docs-origin.sencha.com/extjs/3.4.0/#!/api/Ext.Toolbar-method-removeAll

If you pass false to removeAll it will remove the child items from the toolbar and won't destroy them. The method also returns an array of the removed items. Once empty you can pass a 'default' set of child items to re-populate the toolbar with a standard set of items and when you're ready to swap those with your custom child items that you remove before you can just pass them back as a the param in the toolbar's add() method.

Yemi
10 Sep 2013, 5:44 AM
using toolbar.removeAll(false) does not really work