extjs 从字段集中的列中删除字段
对于我的字段集,我有一个包含不同组件的列布局。
根据组合的值,我想从一列中删除 textField用新的组合替换它。
我有逻辑来获取组合的值,但我似乎无法从列中删除任何项目。
我给了它一个 id,它被返回并尝试执行以下操作:
if(combo.getValue()=="r"){
alert("here");
var col = Ext.getCmp("col"+rowNo);
alert(col.id);
var field = Ext.getCmp("textfield"+rowNo);
col.remove(field, true);
}
列代码
{columnWidth:.14,
id:"col1",
items:[{
xtype: 'textfield',
id: 'textField1',
hideLabel: true,
width: 100
}
With my fieldset, I have a column layout containing different components.
Based on the value of the combo, I want to remove the textField from one column & replace it with a new combo.
I have the logic to get the value of the combo but I can't seem to remove any items from the column.
I have given it an id, which gets returned back and attempted the following:
if(combo.getValue()=="r"){
alert("here");
var col = Ext.getCmp("col"+rowNo);
alert(col.id);
var field = Ext.getCmp("textfield"+rowNo);
col.remove(field, true);
}
Column Code
{columnWidth:.14,
id:"col1",
items:[{
xtype: 'textfield',
id: 'textField1',
hideLabel: true,
width: 100
}
为什么需要物理移除它?您只需将
hidden
属性设置为 true/false,具体取决于您要显示的字段。如果您有两个想要“切换”的字段,设置它们的hidden
属性还将调整布局以适当地适应它们。像这样的东西:
Why do you need to physically remove it? You could just set the
hidden
property to true/false, depending on which fields you want to show. If you have the 2 fields that you want to "toggle", setting theirhidden
property will also adjust the layout to fit them appropriately.Something like: