proxy.connector

webix.proxy.connector

webix.proxy.connector helper.

Please look into the linked official documentation.

References

helpers
ajax().

External references

Official documentation page.

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
webix.proxy.connector = {
    $proxy:true,

    connectorName:"!nativeeditor_status",
    load:function(view, callback){
        webix.ajax(this.source, callback, view);
    },
    saveAll:function(view, updates, dp, callback){
        var url = this.source;

        var data = {};
        var ids = [];
        for (var i = 0; i < updates.length; i++) {
            var action = updates[i];
            ids.push(action.id);

            for (var j in action.data)
                if (j.indexOf("$")!==0)
                    data[action.id+"_"+j] = action.data[j];
            data[action.id+"_"+this.connectorName] = action.operation;
        }

        data.ids = ids.join(",");
        data.webix_security = webix.securityKey;

        url += (url.indexOf("?") == -1) ? "?" : "&";
        url += "editing=true";

        webix.ajax().post(url, data, callback);
    },
    result:function(state, view, dp, text, data, loader){
        data = data.xml();
        if (!data)
            return dp._processError(null, text, data, loader);


        var actions = data.data.action;
        if (!actions.length)
            actions = [actions];


        var hash = [];

        for (var i = 0; i < actions.length; i++) {
            var obj = actions[i];
            hash.push(obj);

            obj.status = obj.type;
            obj.id = obj.sid;
            obj.newid = obj.tid;

            dp.processResult(obj, obj, {text:text, data:data, loader:loader});
        }

        return hash;
    }
};