没想到dgrid这获取时也有坑,困扰我了两三天,幸好有大神帮忙,问题才得到解决。这里记录下。
如果想使用registry.byId来获取dgrid,那么new的时候,需要混入'dgrid/extensions/DijitRegistry'这个扩展。
demo如下:
'dgrid/Grid',
'dgrid/extensions/DijitRegistry',
'dgrid/Selection',
'dgrid/extensions/Pagination',
'dgrid/Selector',
var meituanGrid = new (declare([Grid, Selection, Pagination, Selector, DijitRegistry]))({
//id:"meituanGrid_gird",
collection: store,
selectionMode: 'multiple',
allowSelectAll: true,
loadingMessage: '正在加载数据...',
noDataMessage: '无数据',