Results 1 to 3 of 3

Thread: Center search field in navigationbar when using navigation view

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    1
    Vote Rating
    0
      0  

    Default 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:

    Code:
    config: {        fullscreen: true,
                navigationBar: {
                    items: [
                        {
                            xtype: 'searchfield',
                               placeHolder: 'Search...',
                               listeners: {
                                keyup: function(field) {
                                
                                }
                            }
                        }
                    ]
                },
    
    
            items: [
    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).

    Thanks in advance!

  2. 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.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Feb 2010
    Posts
    8
    Vote Rating
    0
      0  

    Default

    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •