-
14 Apr 2012 8:31 AM #1
Answered: Center search field in navigationbar when using navigation view
Answered: Center search field in navigationbar when using navigation view
Hi!
I'm trying to center a search field in my navigationbar when using a navigation view but I just can make it work. Can someone please show me how? Here's my code:
Everything is working but the searchbar is not centered (note I know I haven't written anything specific for centering it but when I try it doesn't center).Code:config: { fullscreen: true, navigationBar: { items: [ { xtype: 'searchfield', placeHolder: 'Search...', listeners: { keyup: function(field) { } } } ] }, items: [
Thanks in advance!
-
Best Answer Posted by mitchellsimoens
The navigation bar extends titlebar which allows it's items to use the align config. However, the align config for titlebar only accepts left and right. I personally have opened a story for our internal feature request but currently you cannot center align things within a titlebar. The title is the only thing that can be centered.
-
16 Apr 2012 5:03 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
The navigation bar extends titlebar which allows it's items to use the align config. However, the align config for titlebar only accepts left and right. I personally have opened a story for our internal feature request but currently you cannot center align things within a titlebar. The title is the only thing that can be centered.
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 Mar 2013 3:56 PM #3
This took me about a day to figure out:
this.getNavigationBar().leftBox.setCentered(true);Last edited by nello; 23 Mar 2013 at 3:58 PM. Reason: clarity


Reply With Quote