thaiat
17 Feb 2010, 5:39 AM
Hi,
here is a quick and dirty example to reproduce behavior.
Once the window is open, click on the second tab, and then click on the button "show invalid". This will simply call getForm().isValid() and shows the mark invalid icons.
You will see if you go back to first tab (even layoutOnTabChange is true) that the icons are not in a good position.
var form = new Ext.form.FormPanel({
layout : 'vbox',
bodyStyle : 'padding: 5px;background-color: transparent',
layoutConfig : {
align : 'stretch'
},
items : [{
xtype: 'container',
layout : 'form',
defaultType : 'textfield',
defaults : {
anchor : '-20'
},
items : [{
fieldLabel : 'Field 1',
allowBlank : false
}]
}, {
xtype : 'tabpanel',
flex : 1,
activeTab : 0,
deferredRender : false,
layoutOnTabChange : true,
items : [{
title : 'Tab 1',
layout : 'form',
bodyStyle : 'padding: 5px;',
defaultType : 'textfield',
defaults : {
anchor : '-20'
},
items : [{
fieldLabel : 'Sub Field 1',
allowBlank : false
}]
},{
title : 'Tab 2',
layout : 'form',
bodyStyle : 'padding: 5px',
defaultType : 'textfield',
defaults : {
anchor : '-20'
},
items : [{
fieldLabel : 'Sub Field 2',
allowBlank : false
}]
}]
}],
buttons : [{
text : 'Show invalid fields',
handler : function() {
form .getForm().isValid();
}
}]
});
var win = new Ext.Window({
title : 'test',
width : 300,
height : 300,
border : false,
layout : 'fit',
items : form
});
win.show();
Cheers
here is a quick and dirty example to reproduce behavior.
Once the window is open, click on the second tab, and then click on the button "show invalid". This will simply call getForm().isValid() and shows the mark invalid icons.
You will see if you go back to first tab (even layoutOnTabChange is true) that the icons are not in a good position.
var form = new Ext.form.FormPanel({
layout : 'vbox',
bodyStyle : 'padding: 5px;background-color: transparent',
layoutConfig : {
align : 'stretch'
},
items : [{
xtype: 'container',
layout : 'form',
defaultType : 'textfield',
defaults : {
anchor : '-20'
},
items : [{
fieldLabel : 'Field 1',
allowBlank : false
}]
}, {
xtype : 'tabpanel',
flex : 1,
activeTab : 0,
deferredRender : false,
layoutOnTabChange : true,
items : [{
title : 'Tab 1',
layout : 'form',
bodyStyle : 'padding: 5px;',
defaultType : 'textfield',
defaults : {
anchor : '-20'
},
items : [{
fieldLabel : 'Sub Field 1',
allowBlank : false
}]
},{
title : 'Tab 2',
layout : 'form',
bodyStyle : 'padding: 5px',
defaultType : 'textfield',
defaults : {
anchor : '-20'
},
items : [{
fieldLabel : 'Sub Field 2',
allowBlank : false
}]
}]
}],
buttons : [{
text : 'Show invalid fields',
handler : function() {
form .getForm().isValid();
}
}]
});
var win = new Ext.Window({
title : 'test',
width : 300,
height : 300,
border : false,
layout : 'fit',
items : form
});
win.show();
Cheers