Question

Kendo UI V. 2012.2.924

So I'm trying to do something pretty messed up with my kendo tree view. The situation is this: I have a kendo tree view with on demand loading. I also implemented special placeholder nodes that can be clicked to append additional nodes to each level (as a way of batching).

The feature I need to implement is a search. The user can enter a node name and the tree will expand to that node and select it. I have all the logic on the server figured out. The only problem is that with ondemand loading, every time I append a node to a parent, there is a server call to get the contents of that parent. I want to disable this automatic call until my manual appends have been completed. Anyone know if this can be done? I have tried from the server, but if I just return null it has an error. If I return an empty list, it wipes out the existing appended nodes.

Any help would be appreciated.

Was it helpful?

Solution

From the description seems that you are actually willing to disable the load (not just the loadOnDemand).

You can control it in the transport.read implementing functions that check the control variable (the variable saying if loadOnDemand is enabled or disabled).

Example 1: If you have something like:

transport: {
    read: {
        url: "data.jsp"
    },
},

You should transform it into:

transport: {
    read: {
        url: function () {
            if (!disableRead) {
                return "data.jsp"
            }
        }
    },
},

Example 2: If you have something like:

transport: {
    read: function (options) {
        ...
        options.success(data);
    }
},

You should transform it into:

transport: {
    read: function (options) {
        if (!disabledRead) {
            ...
            options.success(data);
        } else {
            options.success([]);
        }
    }
},
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top