是Ext JS社区的新成员。在这里,我想将更改事件应用于子组件“ textfield”。 我已经在控制器中指定了“ onChangeSealNumber”功能。但这并没有被解雇。 有人可以帮我吗?
我尝试了许多方法,但是,如果我在更改时传递匿名函数,它将起作用。但是,当我们明确指定为“ onChangeSealNumber”时,它将无法正常工作。
查看文件
/**
* Search Form Panel View.
* @class 'BulkTransaction.view.searchfrom.SearchForm'
*/
Ext.define('BulkTransaction.view.searchform.SearchForm',{
extend: 'Ext.container.Container',requires: [
'Common.view.widget.RepeatingWidgetGroup','BulkTransaction.view.storagelocation.Storagelocation','BulkTransaction.view.searchform.SearchFormController',],alias: 'widget.searchform',controller: 'searchformcontroller',items: [
{
xtype: 'basepanel',width: '100%',reference: 'searchform',header: false,items: [
{
width: '100%',xtype: 'connect-repeating-widget-group',bind: {
store: '{topSealNumbers}'
},bindReference: 'topSealNumbers',widgetconfig: {
xtype: 'textfield',fieldLabel: BulkTransaction.util.Constants.searchForm.topSealNumbers,allowBlank: false,bind: '{topSealNumbers.searchCriteria}',cls: 'seal-number-field',listeners: {
change: 'onChangeSealNumber'
}
}
}
]
}
]
});
控制文件
/**
* Controller containing the methods implementing functionality
* related to search form
*/
Ext.define('BulkTransaction.view.searchform.SearchFormController',{
extend: 'Ext.app.ViewController',alias: 'controller.searchformcontroller',init: function () {
const me = this;
const viewModel = me.getViewModel();
viewModel.bind({
bindTo: '{topSealNumbers}',deep: true
},me.onSearchCriteriaChange,me);
},/**
* Handle change to the sealnumber details
* @private
*/
onSearchCriteriaChange: function (store) {
const me = this;
let searchCriteriaRecords;
searchCriteriaRecords = store.queryBy(rec =>{
if (!Ext.isEmpty(rec.get('searchCriteria').trim())) {
return rec;
}
});
this.fireEvent('toggleSearchButton',searchCriteriaRecords.length > 0);
},onChangeSealNumber(elm) {
const me = this,view = me.getView();
}
});