开发者

extjs remove field from column in fieldset

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);
                    开发者_如何学C                    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

                        }


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 their hidden property will also adjust the layout to fit them appropriately.

Something like:

if (combo.getValue() == "r") {
    textfield1.show();
} else {
    textfield1.hide();
    textfield2.show();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜