1. #1
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    48
    Vote Rating
    1
    yoh.suzuki is on a distinguished road

      0  

    Default I wish Ext.picker.Picker could use an Ext.NavigationBar as its toolbar

    I wish Ext.picker.Picker could use an Ext.NavigationBar as its toolbar


    It would be nice to be able to center a title on the picker sheet, which would be possible with Ext.NavigationBar.

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    This should work:

    Code:
    Ext.create('Ext.Picker', {
        toolbar: {
            xtype: 'navigationbar',
            title: 'Hello'
        }    
        //other stuff....
    });
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    48
    Vote Rating
    1
    yoh.suzuki is on a distinguished road

      0  

    Default


    Ah ha! Thanks! I tried it a different way and it didn't work so I assumed it wasn't supported. Out of curiosity, is my way incorrect?

    Code:
    Ext.create('Ext.Picker', {
        toolbar: Ext.create('Ext.NavigationBar', {
            title: 'Hello'
        })
        //other stuff....
    });
    It gave me the following message:

    Uncaught TypeError: Object [object Object] has no method 'setShowTitle'

  4. #4
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    You have not added a 'docked' configuration, so it things the toolbar is one of the 'slots', and trying to call that method on it (which obviously doesn't exist). Add 'docked' and it will work.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  5. #5
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    48
    Vote Rating
    1
    yoh.suzuki is on a distinguished road

      0  

    Default


    I see. You are right, that works. The only difference between your code and mine is that I'm passing in an instance of Ext.NavigationBar instead of the config for Ext.NavigationBar. In my experience, normally these two actions are virtually identical.

    Looking at the code, I now see what you are saying:

    Code:
    Ext.applyIf(config, {    
        docked: 'top'
    });
    ... is inside of the function applyToolbar.

    The only comment I have is that this is a little hidden / undocumented. My opinion is that either "docked:'top'" should be similarly required in the config and the configured instance (i.e. inferred in neither place), or they should both automatically receive it (i.e. inferred in both places), to eliminate confusion.

    Thank you for your clarification and help.

  6. #6
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    I guess that make sense. Good work looking at the source.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

Thread Participants: 1