I am unable to understand the behavior of PagingMemoryProxy in EXTJS 3.4. a. It is defined as follows:
proxy:new Ext.ux.data.PagingMemoryProxy(jsonData),
listeners : {
load : {
scope : this,
fn : function(actorStore) {
var r = actorStore.getRange();
var modified = actorStore.getModifiedRecords();
for ( var i = 0; i < modified.length; i++) {
for (j = 0; j < r.length; j++) {
if (r[j].get('plannedResourceId') == modified[i].get('plannedResourceId')) {
var changes = modified[i].getChanges();
for (p in changes) {
if (changes.hasOwnProperty(p)) {
r[j].set(p, changes[p]);
}}}}}}}}
So, the problem what i encountered was when i delete a row using:
gridPanelToRefresh.getStore().removeAt(value.value.rowIndex);
After performing this above mentioned task, when i click on refresh button at that time, the deleted data comes in the grid too. I mean the store which was created using the proxy mentioned above is not getting refreshed.
Can you please suggest some solutions for the same. One lead i got on the same is getModifiedRecords() does not gets the deleted records.
The Best possible approach when dealing with above query is. Following points i have came through while dealing with the issue.
a. The problem was not with the Paging Memory at all. Because it is doing its task perfectly. One thing to take a note in this is whenever we Delete a record at that time the most vital properties namely - modifiedRecords, dirty are never changed so that was the reason why my paging toolbar was not getting updated json as it uses :
var modified = actorStore.getModifiedRecords();
As a result, getmodifiedRecords() returns nothing at all.
Implemenation approach - when my JSONdata is loaded at that time i store it at Global scope and then update that JSON using splice and then upload it to the store whenever a delete event is performed.
for (var i = 0; i < (jsonData.total); i++) {
if(i == indexForRemoval) {
jsonData.data.splice(indexForRemoval,1);
}
}
jsonData.total = ((jsonData.total) - 1);
Hope this helps.