TreeDataLoader

class webix.TreeDataLoader()

Treedataloader mixin

References

helpers
bind().

Referenced by

components
TreeCollection().
views
tree(), treetable().

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
webix.TreeDataLoader = {
    $init:function(){
        this.data.attachEvent("onStoreUpdated", webix.bind(this._sync_hierarchy, this), null, true);

        // #FIXME:  constructor call chain
        //redefine methods
        this._feed_common = this._feed_commonA;
    },
    _feed_commonA:function(id, count, callback, url){
        // branch loading
        var details = (count === 0?{parent: encodeURIComponent(id)}:null);

        webix.DataLoader.prototype._feed_common.call(this,id, count, callback, url, details);
    },
    //load next set of data rows
    loadBranch:function(id, callback, url){
        id = id ||0;
        this.data.url = this.data.url || url;
        if (this.callEvent("onDataRequest", [id,callback,this.data.url]) && this.data.url)
            this.data.feed.call(this, id, 0, callback, url);
    },
    _sync_hierarchy:function(id, data, mode){
        if (!mode || mode == "add" || mode == "delete" || mode == "branch"){
            this.data._sync_to_order(this);
        }
    }
};