-
15 Mar 2013 8:16 AM #1
Answered: check for changes
Answered: check for changes
I guess my question would be what is the best way to track whether or no a data in a store as changed since it was loaded
the catch here is that I have other stores associated to that store.
so I can do
and that will return every field and value as an Object but how can I check if that value has been changed since it has been loaded.Code:store.getData(true)
I could also do a nested store.each and check if record isModified()
but it all comes down to my original question.
What is the Best Way to do it?
-
Best Answer Posted by Farish
To the best of my knowledge:
Code:if(store.getNewRecords().length > 0 || store.getModifiedRecords().length > 0 || store.getRemovedRecords().length > 0) console.log("store records modified");
-
15 Mar 2013 9:05 AM #2
To the best of my knowledge:
Code:if(store.getNewRecords().length > 0 || store.getModifiedRecords().length > 0 || store.getRemovedRecords().length > 0) console.log("store records modified");
-
15 Mar 2013 11:09 AM #3
that does not work in my case. it does not even enter the if statement

-
15 Mar 2013 2:09 PM #4
try:
this should show 3 arrays in the console. if the arrays are empty, that would mean your store has no records to sync. you can also check the documentation of these functions.Code:console.log(store.getNewRecords()); console.log(store.getModifiedRecords()); console.log(store.getRemovedRecords());
-
16 Mar 2013 1:29 AM #5
Actually that did work for me, I was not doing an update records in my form so values never got updated in my model therefore it was not registering that store had modifications
Thanks a lot


Reply With Quote