-
10 Sep 2012 9:23 AM #1
Custom header problems
Custom header problems
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.1 rev ?
- FF15 (firebug 1.9.1 installed)
- I don't know if this counts as a bug, but it is doesn't follow intuition.
There are three problems.
When creating a custom header using the header config in a panel,
- if "title" is not defined on the panel, the header is just the config object passed in, even with "title" defined in the header.
- header buttons appear to the left of the title (this isn't a bug, I just don't know a work-around)
- the title defined on the header will override the one on the panel.
- Create a panel with a custom header
Code:initComponent: function() { Ext.apply(this, { height: 350, width: 400, header: { xtype: 'header', title: "HEADER" }, title: "PANEL", //comment this out } }- Comment out "title" on the panel and refresh.
- A header
- The header didn't appear
- Error: "header.hide is not a function"
- If you step into the code, you'll see that the header is only an object
Possible fix:
I've bolded where problem #1 is. As you can see, if "title" (the panel's title) is defined, no problem.
However, if you define the title on the header, then it fails the check at &A.
It doesn't check for the header's title. If it did, it could work.Code:updateHeader: function(force) { var me = this, //me is the panel header = me.header, title = me.title, //The panel's title tools = me.tools, icon = me.icon || me.iconCls, vertical = me.headerPosition == 'left' || me.headerPosition == 'right'; //&A The check fails here... if ( (header !== false) && (force || (title || icon) || (tools && tools.length) || (me.collapsible && !me.titleCollapse))) { if (header && header.isHeader) { header.show(); } else { // Apply the header property to the header config header = me.header = Ext.widget(Ext.apply({ xtype : 'header', title : title, titleAlign : me.titleAlign, ... ... //configs }, me.header)); me.addDocked(header, 0); // Reference the Header's tool array. // Header injects named references. me.tools = header.tools; } me.initHeaderAria(); } else if (header) { header.hide(); //at this point header is just an object } },
Additional CSS used:- only default ext-all.css
- custom css (include details)
- Solaris 10
word
-
10 Sep 2012 9:52 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
Couple thoughts...
You technically should only specify title either on the panel or on the header config not both. If anything it will save a line of code.
How does the framework know which you actually want to use? IMO the title in the header config should be used where as you are saying the one on the panel should be used.
I do agree that this is a bug:
I'm not sure what you mean by: "header buttons appear to the left of the title (this isn't a bug, I just don't know a work-around)"Code:Ext.define('MyPanel', { extend : 'Ext.panel.Panel', xtype : 'mypanel', initComponent : function() { Ext.apply(this, { header : { xtype : 'header', title : 'HEADER' } }); this.callParent(); } });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.
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-7205
in
4.1.4.


Reply With Quote