-
19 Apr 2012 7:44 AM #1
Answered: Validating data coming from a server
Answered: Validating data coming from a server
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 ?
Thanks
-
Best Answer Posted by mitchellsimoens
If you want to validate the data before it makes it into the store then you need to hook into the reader to validate the data before the reader gives it up to the proxy.
The beforeload event of the store fires before the store sends the request.
-
19 Apr 2012 8:02 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 434
- Answers
- 3102
If you want to validate the data before it makes it into the store then you need to hook into the reader to validate the data before the reader gives it up to the proxy.
The beforeload event of the store fires before the store sends the request.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
19 Apr 2012 10:33 AM #3
Could you please be more specific about "to hook into the reader" ? I don't really know what it means.
-
19 Apr 2012 11:31 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 434
- Answers
- 3102
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Apr 2012 12:45 AM #5
Ok, I've tried this but it doesn't seem to work, any idea why ?
Code:reader: { rootProperty: 'data', getResponseData: function(response){ console.log(response); return response; } }
-
20 Apr 2012 3:58 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 434
- Answers
- 3102
Because you can't override methods when creating an instance. You will need to extend the reader or make an override as I have said.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote