PDA

View Full Version : Multi row toolbar



alexb
23 Nov 2009, 8:39 PM
Ext.override(Ext.Toolbar, {
add : function(){
var a = arguments, l = a.length;
for(var i = 0; i < l; i++){
var el = a[i];
if(el.isFormField){ // some kind of form field
this.addField(el);
}else if(el.render){ // some kind of Toolbar.Item
this.addItem(el);
}else if(typeof el == "string"){ // string
if(el == "separator" || el == "-"){
this.addSeparator();
}else if(el == " "){
this.addSpacer();
}else if(el == "->"){
this.addFill();
}else if(el == "<->"){
this.el = this.container.createChild(Ext.apply({ id: Ext.id },this.autoCreate), /*position*/ null);
this.tr = this.el.child("tr", true);
}else{
this.addText(el);
}
}else if(el.tagName){ // element
this.addElement(el);
}else if(typeof el == "object"){ // must be button config?
if(el.xtype){
this.addField(Ext.ComponentMgr.create(el, 'button'));
}else{
this.addButton(el);
}
}
}
}
});


Use '<->' to create a new row

Caution: memory leak is possible because only the last row is destroyed.