View Full Version : How to open view from button in toolbar

18 Jul 2011, 11:25 AM
I'm very new to Sencha Touch, so as a starting point i've completed the tutorial by Drew Neil http://www.sencha.com/learn/tabs-and-toolbars/ on Tabs and Toolbars.

To start with I tried to extend it to put a button in the toolbar and then add a handle to this to open another view. However the only way I can see to do this is to add the view to the initial ViewPort (but I don't want to display the associated button in the tab bar at the bottom.

Any help on this would be greatly appreciated. At the moment this is what I have, although I suspect it is wrong.

ToolbarDemo.views.Actioncard = Ext.extend(Ext.Panel, {
title: 'Action',
iconCls: 'action',
dockedItems: [
xtype: 'toolbar',
title: 'Actions',
items: [
{ xtype: 'spacer'},
{ id: 'btn2', text: 'Add', ui: 'confirm',
handler: function(){

Ext.reg('actioncard', ToolbarDemo.views.Actioncard);

I just wrapped the code in a try...catch to pick up on any errors.

Also, the only way I can seem to open an existing view is through the index of the view in the items array. Is there a better way to do this?