1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    3
    Vote Rating
    0
    jcarol is on a distinguished road

      0  

    Default Unanswered: Changing proxy leads to calling the wrong destroy method

    Unanswered: Changing proxy leads to calling the wrong destroy method


    I am writing a cash register application that uses a REST proxy to write the order data, which is all working fine. I want to add a "training" mode for new cashiers, so they can learn to use the application without affecting the real data.

    My approach is to simply change the Model's proxy upon entering training mode. I want to change it to a Memory proxy, like so:

    proxy = Ext.create('Ext.data.MemoryProxy', {reader: {type: 'json'}, writer: {type: 'json'}});
    mdl.setProxy (proxy);

    What happens is that the Model.js applyProxy method ends up calling the old proxy's destroy method, intending to free up the memory of the old object. Unfortunately, this method exists in server.js, but does a completely different thing (namely it sends a server request to delete the store data). Clearly this is not what was intended by the applyProxy method.

    Any suggestions as to how to get around this bug?

  2. #2
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    28
    Vote Rating
    0
    jlindbergh is on a distinguished road

      0  

    Default


    I've just stumbled upon this bug too.
    The code causing it is something like this
    Code:
    store = Ext.getStore(theStoreType);
    model = Ext.ModelManager.getModel("MyModel");
    model.setProxy(store.getProxy());
    Which works great the first time it's invoked, but all other calls will fail!
    Running model.setProxy() causes Ext.factory() to run instance.destroy() - trying to destroy the previous proxy instance, but instead ends up calling the destroy(operation, callback, scope) method that is intended to perform a destroy operation via the proxy!

    Maybe the problem is in Model.applyProxy()? If currentProxy was to be removed from that call to Ext.factory() this might work?

  3. #3
    Sencha User kjwenger's Avatar
    Join Date
    May 2012
    Posts
    7
    Vote Rating
    0
    kjwenger is on a distinguished road

      0  

    Default


    In my eyes that's an architectural oversight. Ext.data.Proxy#destroy(operation, callback, scope) and Ext.Base#destroy() clash and the latter should have been called Ext.Base#destructor(). When the destructor is called on an old proxy it is actually triggered to do a destroy operation w/o the required arguments. How could that have escaped the eyes of the ever so watchful Sencha folks ?

    I extended the most used Proxy classes in my code and did override the destroy function so it would not do any damage. I guess one can assume if the parameters operation, callback, and scope are undefined, the destructor was meant, else the mighty destroyer of data.

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