Tôi có nhiều fieldset. Và có nút bên trong mỗi fieldset trong Extjs 4. Tôi muốn nhận id fieldset trên sự kiện click button, để tôi có thể biết từ đó fieldset nút được nhấp vàoExtjs 4 Làm cách nào để lấy id của Component cha?
Làm cách nào để có được điều này?
{
xtype:'fieldset',
id:'fs1',
items:[{
xtype:'button',
id:'b1',
handler:function(){
// here i want to get fieldset's id because because fieldset and button were added dynamically.
}
}]
}
Cảm ơn, Kunal
Actual Code:
Ext.define('My.Group',{
xtype : 'fieldset',
config: {
title:'Group' + i.toString(),
id : '_group' + i.toString()
},
constructor: function(config) {
this.initConfig(config);
return this;
},
collapsible : true,
frame : false,
boder : false,
items : [ {
xtype : 'button',
text : 'Add KeyWord',
id: 'btn',
width : 100,
handler : function(button,event) {
var fieldset = button.findParentByType('fieldset');
var fieldsetsID = fieldset.getId();
console.log(fieldset);
Ext.getCmp(fieldsetId).insert(2, rangeField);
Ext.getCmp(fieldsetsID).doLayout();
}
}, {
xtype : 'button',
text : 'Add Range Type',
width : 100
} ]
});
và tôi đang gọi chức năng này trên nút bấm
handler : function() {
i=i+1;
var group = new My.Group({
title:'Group' + i.toString(),
id : '_group' + i.toString()
});
console.log(group);
Ext.getCmp('_aspanel').insert(i, group);
Ext.getCmp('_aspanel').doLayout();
tôi muốn truy cập id fieldset thông qua nút. bởi vì tôi có nhiều fieldset. Và tôi muốn thêm somthing vào một fieldset cụ thể mà từ đó button được click. – Kunal