PDA

View Full Version : Ext.Toolbar configurable Spacer: extending Ext.Toolbar.Spacer



mabello
10 Jun 2008, 9:22 AM
I had the need to create and put in a toolbar a text field in a configurable position (let say in the middle).
So I have created a small configurable spacer that do the job for me, extending Ext.extend(Ext.ux.MyFill, Ext.Toolbar.Spacer);

Code:


Ext.ux.MyFill = function(tWidth){
Ext.ux.MyFill.superclass.constructor.call(this);

var width = tWidth;

this.render = function(td){
td.style.width = width;
Ext.Toolbar.Fill.superclass.render.call(this, td);
}
}
Ext.extend(Ext.ux.MyFill, Ext.Toolbar.Spacer);


Usage:


panel.getTopToolbar().addItem(new Ext.ux.MyFill('45%'));

Cheers

galdaka
10 Jun 2008, 12:14 PM
Hi,

Excellent work! Have you add this plugin in TreeFilterPanel for configure the position of the searchfield?

If you calculate the width of the toolbar and resize the textfield, with this plugin, you can auto-adjust the serachfield in to the toolbar (like MSN messenger serachfield)

Is posible?

Thanks in advance,

mabello
11 Jun 2008, 4:21 AM
Thanks galdaka.
I've tried to fix the problem with the accordion layout in TreeFilterPanel plugin, but I think the main problem is that the accordion layout is a little bit buggy, so it's not so trivial to fix that...
Hence, I have not try to alculate the width of the toolbar and resize the textfield yet, but I will give it a shot, I think it could be achievable.

Thanks