我開發使用ExtJS的電網分頁複選框網格列表。在執行頁面導航時,我需要記住所選記錄。EXTJS 3.3.3電網
詳細說明: 1)轉到頁:1和選定的行1,2和3 2)現在導航頁面:2 3)回到頁:1 4)的行1,2和作爲選擇
有沒有在網格中的任何API,它處理這種功能,已經選定3應該顯示?
在此先感謝。
我開發使用ExtJS的電網分頁複選框網格列表。在執行頁面導航時,我需要記住所選記錄。EXTJS 3.3.3電網
詳細說明: 1)轉到頁:1和選定的行1,2和3 2)現在導航頁面:2 3)回到頁:1 4)的行1,2和作爲選擇
有沒有在網格中的任何API,它處理這種功能,已經選定3應該顯示?
在此先感謝。
感謝您的答覆。通過實現一個插件來實現我的設計。該插件看起來,
Ext.namespace('Ext.ux.plugins');
Ext.ux.plugins.CheckBoxMemory = Ext.extend(Object,
{
constructor: function(config)
{
if (!config)
config = {};
this.prefix = 'id_';
this.items = {};
this.idProperty = config.idProperty || 'id';
},
init: function(grid)
{
this.view = grid.getView()
this.store = grid.getStore();
this.sm = grid.getSelectionModel();
this.sm.on('rowselect', this.onSelect, this);
this.sm.on('rowdeselect', this.onDeselect, this);
this.store.on('clear', this.onClear, this);
this.view.on('refresh', this.restoreState, this);
},
onSelect: function(sm, idx, rec)
{
this.items[this.getId(rec)] = true;
},
onDeselect: function(sm, idx, rec)
{
delete this.items[this.getId(rec)];
},
restoreState: function()
{
var i = 0;
var sel = [];
this.store.each(function(rec)
{
var id = this.getId(rec);
if (this.items[id] === true)
sel.push(i);
++i;
}, this);
if (sel.length > 0)
this.sm.selectRows(sel);
},
onClear: function()
{
var sel = [];
this.items = {};
},
getId: function(rec)
{
return rec.get(this.idProperty);
}
});
這個插件被稱爲從束腰爲,
Ext.grid.Gridpanel({
store: 'someStore',
plugins: [new Ext.ux.plugins.CheckBoxMemory({idProperty: "recordID"})]
});
希望這有助於一些之一。
你可以把一個MixedCollection對象在全球範圍內跟蹤這些記錄。這將允許您存儲不同對象類型的全局設置。
2007年4月,sencha.com/forums上的用戶evant實現完全相同。這裏是鏈接:https://www.sencha.com/forum/showthread.php?45723-problem-in-grid-pagination&highlight=getselectionmodel – JosefMadrid