-
1 Mar 2012 8:55 AM #1
Answered: How to add a button into the panel title header?
Answered: How to add a button into the panel title header?
How to add a button into the panel title header right after the title?
-
Best Answer Posted by mitchellsimoensCode:
var panel = new Ext.panel.Panel({ renderTo : document.body, width : 400, height : 400, title : 'Test' }); panel.header.add({ xtype : 'button', text : 'Test' });
-
1 Mar 2012 1:49 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
The header is basically a container using hbox layout (vbox if header is on left or right). Therefore you can use add/insert/remove on that header component. There is no config to do this, you will have to do it manually after the header is created.
Mitchell 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.
-
2 Mar 2012 7:19 AM #3
How to get the title header container?
-
2 Mar 2012 7:21 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
Mitchell 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.
-
2 Mar 2012 8:36 AM #5
-
2 Mar 2012 8:43 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
Code:var panel = new Ext.panel.Panel({ renderTo : document.body, width : 400, height : 400, title : 'Test' }); panel.header.add({ xtype : 'button', text : 'Test' });Mitchell 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.
-
5 Mar 2012 7:37 AM #7
-
5 Mar 2012 7:39 AM #8Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
- Answers
- 3102
Use insert instead of add
Mitchell 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.
-
23 Aug 2012 8:09 AM #9
Note: this does not work, if the panel is to be a child item of a container (i.e. the renderTo property is empty), because then panel is not rendered upon creating it.
In this case add the buttons in a render-event handler instead.
If the panel is collapsible, you'll have to use insert, starting with index 1.
-
29 Aug 2012 8:14 AM #10
Ditto above. Unfortunately, the alignment is still a problem. I did this:
flex: 1 will put it about halfway, 5 three-quarters. I had to go to about 18 to get it where I wanted it.Code:obj.header.add([{ xtype: 'button', text : 'HI' },{ xtype: 'component', flex: 1 }])
Edit: Changing the alignment to left will probably fix the centering issueword


Reply With Quote