例如,我有5个带有元素的dataView(简单行)。是否存在实现此dataView之间多重选择的能力(所有这些dataView都有不同的数据存储)?我的意思是非算法实现......当然,我可以编写一些逻辑来实现它,但也许存在一些标准解决方案?
答案 0 :(得分:0)
你可以尝试这样的事情,也许这可行:
Ext.define('MyApp.controller.DataViews', {
extend : 'Ext.app.Controller',
init : function() {
this.views = {};
this.listen({
component: {
'dataview-1' : {
'render' : this.onDataViewRender,
'itemclick' : this.onItemClick
},
'dataview-2' : {
'render' : this.onDataViewRender,
'itemclick' : this.onItemClick
}
}
});
},
onDataViewRender: function(view){
this.views[view.getXType()] = view;
},
onItemClick: function(view, record, items, index, e){
//If Ctrl is not pressed when clicking an item, clear the selection of all views before proceeding
if(!e.ctrlKey)
{
Ext.Object.each(this.views, function(xtype, viewObj){
viewObj.getSelectionModel().deselectAll();
});
}
}
});
Ext.define('MyApp.view.DataView1', {
extend: 'Ext.view.View',
xtype: 'dataview-1',
multiSelect: true,
});
Ext.define('MyApp.view.DataView2', {
extend: 'Ext.view.View',
xtype: 'dataview-2',
multiSelect: true,
});