EXTJS grid.column.renderer绑定失效

2020-08-11 14:54:25 浏览数 (2)

案例

extjs版本: 7 modern

代码语言:javascript复制
items:[{
	xtype: 'grid',
	itemConfig: {
	    viewModel: {},
	    controller: {}
	},
	columns: [{
		renderer: 'clmnRenderer'
	}]
}],
...
controller: {
	clmnRenderer: function(value){return value;}
}

此案例中renderer绑定无效,报错提示

代码语言:javascript复制
Uncaught Error: No method named "clmnRenderer" on Ext.app.ViewController

解析

由于grid实现了itemConfig,导致renderer的scope由视图controller变成了itemConfig.controller,从而引发绑定失效

0 人点赞