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([]);
}
}
},