PDA

View Full Version : [OPEN] [FIXED-222][3.x SVN] Error on removing hidden field from form



jburnhams
3 Sep 2009, 7:39 AM
See below example, a form is created that contains a hidden field. When you try to remove the field, the FormLayout onRemove function checks if it is rendered and tries to remove its container. The hidden field is shown as rendered, however the itemCt is undefined.


<html>
<head>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext-all.js"></script>
</head>

<body>
<script type="text/javascript">
Ext.onReady(function(){
new Ext.Viewport({
items: [{
xtype: 'form',
id: 'tform',
items: [{
xtype: 'hidden',
id: 'thidden'
}]

}]
});

Ext.getCmp('tform').remove('thidden');
});
</script>
</body>
</html>

jburnhams
3 Sep 2009, 7:55 AM
This fix seems to work:


onRemove: function(c){
Ext.layout.FormLayout.superclass.onRemove.call(this, c);
if(this.trackLabels && !this.isHide(c)){
c.un('show', this.onFieldShow, this);
c.un('hide', this.onFieldHide, this);
}
var ct = c.getItemCt();
if(c.rendered && ct){
var el = c.getPositionEl();
el.insertAfter(ct);
Ext.destroy(ct);
Ext.destroyMembers(c, 'label', 'itemCt');
if(c.customItemCt){
Ext.destroyMembers(c, 'getItemCt', 'customItemCt');
}
}
},

evant
3 Sep 2009, 10:15 PM
Thanks for the fix.

Fix applied to svn in rev #5284 for patch release 3.0.2.

sramanna
8 Sep 2009, 12:29 PM
I get a c.getItemCt() not a function.

I am on Ext 3.0.1 and I am applying this as a override on form layout to fix this problem.

ivaylo.bakalov
9 Sep 2009, 6:10 AM
and here is a fix: http://www.extjs.com/forum/showthread.php?p=384698#post384698