I have a store that loads data through a ajax proxy. What I would like to do is to check the data (like the value of an attribute) before the store loads.
I have already tried to do it with the ‘before load’ event of a store, but somehow when I try to get the records from there with operation.getRecords(); it gives me an empty array..
I know there is some validation system in Sencha Touch but it does not seem to include data coming from a server
Does anyone have a solution for this ?
Update
Ok, even though the temp store would be a solution, I found another one which consists in checking after the store loads and then removing dirty records from it.
Also, on Sencha Forum, I’ve been told to “extend the reader (json or xml…) and then validate the data in getResponseData (the method that decodes the response to JavaScript).”
So I’ve tried this in my store
reader: {
rootProperty: 'data',
getResponseData: function(response){
console.log(response);
return response;
}
}
But it doesn’t change anything, any idea why ?
Thanks
There is no clean way to do this.
beforeloadis called before the actual request is made, so it is no use to you.The cleanest way I can think of is to listen to the
loadevent (on a temporary store) and then validate your data there. If it is correct, then move that stores data into the visible store.