DHX.Proxy I need help!!

Hello,

I am new in Dhtmlx Touch, and I want to create an app which is working when offline or no internet available.

I use the dhx.proxy component, in saving data, from form and a grid…

this.orderSave = new dhx.proxy({
        url: innowave.base_url + "order?r=savemobile",
        storage: dhx.storage.local
});


$$('btn_save').attachEvent('onItemClick', function() {
        var data = new Object();
        data["detail"] = new Object()
        data["detail"] = $$("detail_grid").serialize();

        data["order"] = new Object();
        data["order"] = $$("orderForm").getValues();
        data["order"].employee = "ire05049200";


        var params = ["data=" + JSON.stringify(data)]; // request parameters list

        that.orderSave.post(params.join('&'), {
            success: function(e) {
                dhx.notice("success " + e);
            },
            error: function(e) {
                dhx.notice("fail " + e);
            }
        });

    });

then I tested it, when there is a connection to the server, obviously data will be save to the database, and when i turn off the connection of my mobile to the database, and send a request i will get the message “fail”, in this case i thought that the data will be save in local storage(dhx.storage.local) and will be send again if there’s a connection in the server. So, I connect the mobile again to the server, and send another request, the request is save to the database, but the request that i did while the mobile is offline are not sent to the dtabase…

can you please tell me, how does this dhx.proxy works?.. or how can i implement this?

thanks in advance! :smiley:

ok, i see that the request data are storede in localStorage, using console.log(localStorage),

According to the documentation :
*Each time a user makes a request, dhx.proxy checks presence of unsuccessful requests in the local storage. If there are any kept - they are passed to the server.
*As soon as an unsuccessful request is satisfied - it updates the latest copy and is removed from the local storage.

Is the checking of dhx.proxyof unsuccessful requests in the local storage are done automatically eahc time a user makes a request?, and if there are any, it will passed to the server, automatically?, or do I need to do this manually?

Right now, im doing this manually, and im hoping that there’s a way to do this manually.

EDIT*
Right now, im doing this manually, and im hoping that there’s a way to do this automatically.

Hello,

We have found an issue with “offline” ajax. Please try attached libs. They will fix the problem.
libs.zip (174 KB)

Hello Alexandra,

You’re attached files works, thanks a lot! :smiley:

can’t it be that there also should be a new css file ?
while using this last lib my Tabbar elements appear under each other , my popup screen open under the active screen …

sorry was wrong edit … no problems yet