It would be nice to be able to center a title on the picker sheet, which would be possible with Ext.NavigationBar.
It would be nice to be able to center a title on the picker sheet, which would be possible with Ext.NavigationBar.
This should work:
Code:Ext.create('Ext.Picker', {
toolbar: {
xtype: 'navigationbar',
title: 'Hello'
}
//other stuff....
});
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?
It gave me the following message:Code:Ext.create('Ext.Picker', {
toolbar: Ext.create('Ext.NavigationBar', {
title: 'Hello'
})
//other stuff....
});
Uncaught TypeError: Object [object Object] has no method 'setShowTitle'
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.
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:
... is inside of the function applyToolbar.Code:Ext.applyIf(config, {
docked: 'top'
});
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.
I guess that make sense. Good work looking at the source.