当我尝试从 URL 获取值以设置按钮是否被禁用时,我在视图中收到以下错误。
ReferenceError: getUrlParams is not defined
为什么在定义方法时会出现此错误?
我的观点
Ext.define('AM.view.commission.CommissionList' ,{
extend: 'Ext.grid.Panel',
alias: 'widget.commissionlist',
store: 'ActiveCommissions',
initComponent: function() {
this.columns = [
{header: 'From', dataIndex: 'from', flex: 2},
{header: 'To', dataIndex: 'to', flex: 2},
{header: 'Status', dataIndex: 'status', flex: 5},
{header: 'Levels', dataIndex: 'levels', flex: 5},
{header: 'Payment Period', dataIndex: 'paymentPeriod', flex:5 }
];
this.buttons = [ {
id:'addCommissionBtn',
text : 'Add commission',
action: 'createcommission',
disabled: getUrlParams
}];
this.callParent(arguments);
}
,getUrlParams: function() {
var params = Ext.urlDecode(window.location.search.substring(1));
return params['edit'] || null;
}
});