-
13 Jan 2012 1:23 PM #1
Dynamically adding component in toolbar
Dynamically adding component in toolbar
I do add checkbox into toolbar dynamically (it was fine in 4.0)
but with 4.1 upgrade, I can add as before as below with no problem
Ext.getCmp("toolbarID").add(checkbox);
but layout is bit messed up, displaying the items diagonally.
If you add the same component statically, it renders fine.
-
13 Jan 2012 1:59 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
This code:
Got me this result:Code:Ext.create('Ext.panel.Panel', { renderTo : Ext.getBody(), width : 400, height : 400, title : 'Test', html : 'Hello', dockedItems : [ { xtype : 'toolbar', dock : 'top', items : [ { text : 'Add Comp', handler : function(btn) { var toolbar = btn.up('toolbar'); toolbar.add({ xtype : 'checkboxfield', boxLabel : 'Checkbox' }); } } ] } ] });
Screen Shot 2012-01-13 at 3.58.26 PM.pngMitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Jan 2012 3:09 PM #3


Reply With Quote