function onChange(args) { // this function will be called when the resource is checked/unchecked
var schObj = $("#Schedule1").data("ejSchedule");
dataManager2 = ej.DataManager({
url: '@Url.Action("owner","Home")',
crossDomain: true
});
dataManager2.adaptor = new ej.UrlAdaptor();
var ds = dataManager2.executeQuery(new ej.Query());
ds.done(function (e) {
var resourceObject = ej.DataManager(e.result).executeLocal(ej.Query().where("resText", ej.FilterOperators.equal, args.model.text)); // here we will filter particular resource that is checked/unchecked
if (args.isChecked)
changeClick(resourceObject);
else
removeClick(resourceObject);
});
}
function changeClick(args) { // this function will be called when the resourse is checked
var schObj = $("#Schedule1").data("ejSchedule");
schObj.model.resources[0].resourceSettings.dataSource.push(args[0]); // here we are dynamically adding the checked resource
var resVal = schObj.model.resources[0].resourceSettings.dataSource;
var dataManager1 = ej.DataManager({
url: '@Url.Action("GetData","Home")',
// url:"/Home/GetData",
crudUrl: '@Url.Action("Batch", "Home")',
crossDomain: true
});
------------
------------
}
function removeClick(value) { // this function will be called when the resourse is un-checked
var schObj = $("#Schedule1").data("ejSchedule");
ej.DataManager(schObj.model.resources[0].resourceSettings.dataSource).remove("resId", value[0].resId); // here we are dynamically removing the unchecked resource
var resVal = schObj.model.resources[0].resourceSettings.dataSource;
$("#Schedule1").ejSchedule({
resources: [{
field: "OwnerId",
title: "Owner",
name: "Owners", allowMultiple: true,
resourceSettings: {
dataSource: resVal,
text: "resText", id: "resId", color: "rescolor"
}
}],
});
}
</Code>
Regards,
Karthigeyan