开发者

extjs remove field from column in fieldset

开发者 https://www.devze.com 2023-04-11 04:22 出处:网络
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.

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

精彩评论

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

关注公众号