ExtJS アイテムの参照
ExtJSでのアイテムの参照、取得したいComponentに “itemId” を指定し、参照する際に、”#itemId” をセレクターに指定する。
View:
Ext.define('App.view.MyPanel',
{
extend:'Ext.panel.Panel',
alias: 'widget.mypanel',
title:'MyPanel',
items:[
{
xtype:'button',
text:'button1',
itemId:'btnTest1'
},
{
xtype:'button',
text:'button2',
itemId:'btnTest2'
}
]
});
Controller:
Ext.define('App.controller.MyController',
{
extend:'Ext.app.Controller',
views: ['MyPanel'],
refs: [
{
ref: 'mypanel', selector: 'myPanel'
}
],
init:function()
{
this.control(
{
'myPanel #btnTest1':
{
click:this.onButtonClick
},
'button':
{
click:this.onButtonClick
}
});
this.application.on(
{
});
},
onButtonClick:function(button, event, eOpts)
{
this.application.fireEvent('sendTheClick');
}
});
View:
Ext.define('App.view.MyPanel',
{
extend:'Ext.panel.Panel',
alias: 'widget.mypanel',
title:'MyPanel',
items:[
{
xtype:'button',
text:'button1',
itemId:'btnTest1'
},
{
xtype:'button',
text:'button2',
itemId:'btnTest2'
}
]
});
Controller:
Ext.define('App.controller.MyController',
{
extend:'Ext.app.Controller',
views: ['MyPanel'],
refs: [
{
ref: 'mypanel', selector: 'myPanel'
}
],
init:function()
{
this.control(
{
'myPanel #btnTest1':
{
click:this.onButtonClick
},
'button':
{
click:this.onButtonClick
}
});
this.application.on(
{
});
},
onButtonClick:function(button, event, eOpts)
{
this.application.fireEvent('sendTheClick');
}
});
コメント
コメントを投稿