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


    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
    Vote Rating
    jlindbergh is on a distinguished road



    I've just stumbled upon this bug too.
    The code causing it is something like this
    store = Ext.getStore(theStoreType);
    model = Ext.ModelManager.getModel("MyModel");
    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?

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar