jerrybrown5
24 Feb 2008, 11:18 PM
Perhaps you should add this to the next build.
Ext.apply(Ext.Container.prototype,{
validate: function(id){
var valid=true;
if(this.items){
var cs = this.items.items;
var childContainers=[];
for(var i = 0, len = cs.length; i < len; i++){
if (cs[i].items){/*this is a child container..move it to the end*/
childContainers.push(cs[i]);
}else if (cs[i].validate){
if (!cs[i].validate()){ valid=false; }
}
}
if (valid){
for(var i = 0, len = childContainers.length; i < len; i++){
if (cs[i].validate && !cs[i].validate()){ valid=false; break;}
}
}
}
return valid;
}
});
This allows you to easily do this.
xtype:'tabpanel',
...
listeners:{
'beforetabchange':function(tabPanel, newTab, currentTab){
if (currentTab) { return currentTab.validate() }
}
},
Ext.apply(Ext.Container.prototype,{
validate: function(id){
var valid=true;
if(this.items){
var cs = this.items.items;
var childContainers=[];
for(var i = 0, len = cs.length; i < len; i++){
if (cs[i].items){/*this is a child container..move it to the end*/
childContainers.push(cs[i]);
}else if (cs[i].validate){
if (!cs[i].validate()){ valid=false; }
}
}
if (valid){
for(var i = 0, len = childContainers.length; i < len; i++){
if (cs[i].validate && !cs[i].validate()){ valid=false; break;}
}
}
}
return valid;
}
});
This allows you to easily do this.
xtype:'tabpanel',
...
listeners:{
'beforetabchange':function(tabPanel, newTab, currentTab){
if (currentTab) { return currentTab.validate() }
}
},