Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1811 in a recent build.
  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    20
    Vote Rating
    0
    John2011 is on a distinguished road

      0  

    Default B1 Ext.Store.setProxy() not working

    B1 Ext.Store.setProxy() not working


    I am upgrading mt app to Sencha Touch 2.0.0 b1 and have found that the code which calls setProxy() now breaks.

    Code:
    MyApp.stores.Location.setProxy(proxy);
    Safari's web console displays the following error:

    Code:
    TypeError: 'undefined' is not an object (evaluating 'operation.getParams') sencha-touch-all-debug.js:31069
    In the changelog, I find the following message but I find it to be kind of vague and don't know how to proceed:
    Fixed Model.load to automatically set itself as the model on the operation. Also update the model on proxy in Store when you define a new one
    How do I assign a new proxy to my datastore?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Can I get a test case as looking at the code it should work.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    20
    Vote Rating
    0
    John2011 is on a distinguished road

      0  

    Question Test case

    Test case


    This is a minimalized example of my code that triggers the error "TypeError: 'undefined' is not an object (evaluating 'operation.getParams')" in Sencha Touch 2.0.0 beta 1.

    The code is contained in the "action"-listener of a search field.

    I have been unable to find a workaround.

    Code:
    var proxy = Ext.create('Ext.data.AjaxProxy', {
        timeout: 10000,
        reader: {
            type: 'json',
            rootProperty: 'locations',
        },
        afterRequest: function(request, success) {
        }
    });
                                
    proxy.url = 'http://example.com/api/locations.json.php?range=10&type=' + encodeURIComponent(MyApp.data.locationType) + '&q=' + encodeURIComponent(MyApp.views.searchField.getValue());        
    
    console.log(proxy);
    
    MyApp.stores.Location.setProxy(proxy);                    
    MyApp.stores.Location.load();

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Hi,

    There are several things in your code that could be the problem. First of all, in ST2 if you want to change a configuration on an instance (like your trying to do with the url), you have to use the setters. So for you it would be proxy.setUrl(). Second, you don't have to go through all the work of creating a url string like that yourself. You can just use the params in your proxy or when you call the load method. Third, you are setting a proxy and calling load on a Class definition, not on an instance of your store it seems.

    Anyway, in the latest code branch, if you run the following code it all seems to work as expected for me.

    Code:
            Ext.setup({
                onReady : function() {
                    var store = Ext.create('Ext.data.Store', {
                        fields: ['location']
                    });
    
                    var proxy = Ext.create('Ext.data.AjaxProxy', {
                        timeout: 10000,
                        reader: {
                            type: 'json',
                            rootProperty: 'locations'
                        },
                        extraParams: {
                            type: 'LocationType'
                        },
                        enablePagingParams: false,
                        afterRequest: function(request, success) {
                        }
    
                        // Would probably be best to just set the url here and use
                        // params when calling load method
                    });
    
                    proxy.setUrl('http://example.com/api/locations.json.php');
                    store.setProxy(proxy);
    
                    store.load({
                        params: {
                            range: 10,
                            q: 'SomeValue'
                        }
                    });
                }
            });
    This creates the following request to the server.


Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi