-
1 Jun 2012 1:38 AM #1
Answered: Customize Proxy !
Answered: Customize Proxy !
I'm French, sorry for my poor English
I made a custom personnal proxy for WeqSql storage (i use Phonegap)
On the functions (read, update, etc...), we give a "operation" parameter.
I want to know how to customize this variable.
In fact, i use the proxy to read differents sql tables, and depending on the store where i call the Proxy, i want to read a particular table.
For example, i want to call Ext.getStore('Products').load() with the table 'Products', and Ext.getStore('Rubrics').load() with the table 'Rubrics'.
Here a VERY SIMPLE example :
Thanks for the help !Code:read: function(operation, callback, scope) { if(operation.model = "products"){ request('SELECT * FROM PRODUCTS'); } else(operation.model = "rubrics"){ request('SELECT * FROM RUBRICS'); } }
-
Best Answer Posted by Luc
Assuming your application is named 'App' and you have created ST models App.model.Product and App.model.Rubics, try:
Code:read: function(operation, callback, scope) { if(operation.getModel() == App.model.Product ){ //request('SELECT * FROM PRODUCTS'); } else(operation.getModel() == App.model.Rubics ){ //request('SELECT * FROM RUBRICS'); } }
-
3 Jun 2012 12:57 PM #2
Assuming your application is named 'App' and you have created ST models App.model.Product and App.model.Rubics, try:
Code:read: function(operation, callback, scope) { if(operation.getModel() == App.model.Product ){ //request('SELECT * FROM PRODUCTS'); } else(operation.getModel() == App.model.Rubics ){ //request('SELECT * FROM RUBRICS'); } }


Reply With Quote