Therefore, I need to create an ExtJS component (version 2.3.0). The component is simple HTML (style) - this is the title.
My current approach is to create a custom component as follows:
Ext.ux.AppHeader = Ext.extend(Ext.Component, { height: 32, tpl: new Ext.Template ('<div class="title-bar"><h1>My App</h1></div>'), onRender: function(ct) { this.el = this.tpl.append (ct); Ext.ux.AppHeader.superclass.onRender.apply(this, arguments); } }); Ext.reg('AppHeader', Ext.ux.AppHeader);
This works great, but I'm not sure if this is the “right” way to do it. If someone could use a more idiomatic way to do it, or a method that uses ExtJS's internal magic better, that would be great.
If, on the other hand, this is the “right” way to do it, let it be an example of how you can.
Edit
I definitely tried to handle it. The approach I'm using right now is:
{ html: '<div class="title-bar"><h1>My App</h1></div>' }
and define the CSS string "title-bar" so that the text has the correct style / size, and ExtJS does the right thing.
source share