-
18 Jun 2012 6:07 AM #1
Unanswered: How te get data from DB with toolbar?
Unanswered: How te get data from DB with toolbar?
Hello,
I'm trying to create a menu by using the toolbar menu but in the example, the data are filled with the 'text' option. I would like to make it work with data from my DB as I won't need to come back in the code if a new option should appear.
My second question is a bit more complex, I don't know how to interact with another part of my screen when I click on the selected item. I've tried to create a Handler with a simple alert but nothing happened.
Thanks in advanced for any help.Code:Ext.define('TAB.view.MainBorder', { extend: 'Ext.panel.Panel', alias:'widget.mainborder', layout: 'fit', initComponent: function() { var me = this; Ext.applyIf(me,{ items: [ { xtype: 'panel', dockedItems: [{ dock: 'top', xtype: 'toolbar', height: 40, xtype: 'button', text: 'Choose indicator group', menu: { plain: true, showSeparator: false, items: [{ text: 'menu item one', scope: this, handler: this.onAddClick }, { text: 'menu item two' }, { text: 'menu item three' }] }, onAddClick: function(){ alert('test'); } }] } ], // }) me.callParent(arguments); } });
Regards,
-
18 Jun 2012 9:00 AM #2
I think your scope for the event handling function is wrong, try this:
Code:Ext.define('TAB.view.MainBorder', { extend: 'Ext.panel.Panel', alias:'widget.mainborder', layout: 'fit', onAddClick: function(){ alert('test'); }, initComponent: function() { var me = this; Ext.applyIf(me,{ items: [{ xtype: 'panel', dockedItems: [{ dock: 'top', xtype: 'toolbar', height: 40, xtype: 'button', text: 'Choose indicator group', menu: { plain: true, showSeparator: false, items: [ { text: 'menu item one', scope: this, handler: this.onAddClick }, { text: 'menu item two' }, { text: 'menu item three' } ] } }] }] }); me.callParent(arguments); } });Last edited by sdt6585; 18 Jun 2012 at 9:03 AM. Reason: messed up the formatting big time
-
18 Jun 2012 9:19 AM #3Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
-
20 Jun 2012 5:19 AM #4
Thanks, it works.


Reply With Quote