コンボからリスナーを使用して ext.js (xtype:"compositefield") を表示/非表示にしようとしています。複合フィールドのラベルが非表示にならないことを除いて、すべてがうまく機能します。.hide()/.show() を使用できるように、複合フィールド DOM 要素全体を選択するにはどうすればよいですか?
複合フィールドのコード:
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();
}
}
}