[英]PagingMemory Proxy is not getting refreshed when the store is updated using removeAt(rowindex)
[英]Extjs: Delete Row from store-> store.removeAt(RowIndex)
我在GridPanel中的商店中有一堆RowIndexes。 我想從我的商店刪除這些。 如果我只有一個,沒問題,網格的視圖是refrsehd,唯一的條目是。
但是當我有超過0時,例如10個RowIndexes,我就像這里一樣循環...
for(rowIndex in indexes)
{
store.removeAt(indexes[rowIndex]);
}
...只從網格中刪除了幾個條目。 我覺得循環太快了? 我已經暫停了它,但是也沒有用。 有沒有人有想法? 謝謝!!!
我會嘗試以相反的順序刪除行。 你試過嗎? 就像是
var i = indexes.length - 1;
for (; i >= 0; i--){
store.removeAt(indexes[i]);
}
我知道答案已被接受,但我想我會補充說,每次調用Ext.data.Store#removeAt
為每個索引調用Ext.data.Store#removeAt
都會觸發一個datachanged
事件。 如果您有datachanged
偵聽器,則可能會遇到性能問題或意外行為。 由於removeAt(index)
只是remove(getAt(index))
一個方便的別名,所以你可以這樣做。
function batchRemoveAt(store, indexes) {
var records = Ext.Array.map(indexes, function (index) {
return store.getAt(index);
});
store.remove(records);
}
這將為整個刪除觸發單個datachanged
事件,並為每個刪除的記錄觸發單個remove
事件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.