1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    12
    Vote Rating
    1
    a7xntho is on a distinguished road

      0  

    Default 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 :

    Code:
    read: function(operation, callback, scope) {
        if(operation.model = "products"){
            request('SELECT * FROM PRODUCTS');
        }   else(operation.model = "rubrics"){
            request('SELECT * FROM RUBRICS');
        }
    }
    Thanks for the help !

  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');
        }
    }

  3. #2
    Ext Premium User
    Join Date
    Mar 2007
    Posts
    89
    Answers
    2
    Vote Rating
    1
    Luc is on a distinguished road

      0  

    Default


    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');
        }
    }

Thread Participants: 1

Tags for this Thread