我正在尝试使用组合中的侦听器显示/隐藏 ext.js (xtype:"compositefield")。一切正常,除了复合字段的标签不会隐藏。如何选择整个复合字段 DOM 元素,以便可以在其上使用 .hide()/.show() ?
复合字段的代码:
xtype: 'compositefield',
                   labelStyle: 'width: 60px',
                   fieldLabel: 'Player 1',
                   id: "player_1_fields",
                   msgTarget: 'under',
                   items:[
                       {xtype: 'displayfield', value: 'Name',margins: '3 5 0 22'},
                       {xtype: 'textfield', name: 'props_name_1', width: 135},
                       {xtype: 'displayfield', value: 'Score',margins: '3 5 0 0'},
                       {xtype: 'numberfield', name: 'props_score_n1', width: 35}
                   ]
监听器的代码:
listeners: {
                                    select: function(combo, record, index) {
                                     if ( combo.getValue() == "2" ) 
                                                {
                                                Ext.getCmp("player_1_fields").getEl().hide();
                                                }
                                            else
                                                {
                                                Ext.getCmp("player_1_fields").getEl().show();
                                                }
                                    }
                                  }