mbraak / jqTree

Tree widget for jQuery
https://mbraak.github.io/jqTree/
Apache License 2.0
1.02k stars 177 forks source link

Add ajax dataFilter to filter the returned data from jQuery.ajax for the load_on_demand feature #180

Closed cheton closed 9 years ago

cheton commented 11 years ago

Since the returned result of load_on_demand from backend server may not in the form of jqtree's data format, it will be great if a dataFilter function is provided as tree option.

Example:

$.tree({
    dataUrl: function(node) { ... },
    dataFilter: function(data) {
        // process the load_on_demand data
        return data;
    }
});

In the tree.jquery.js

$.ajax({
    dataFilter: _this.options.dataFilter
});
mbraak commented 11 years ago

Yes. I think this is a good idea. I will add this option.

mbraak commented 11 years ago

The dataFilter option is now added to the dev branch.