We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Change resources in code

Thread ID:





121950 Feb 11,2016 08:03 AM UTC Feb 12,2016 01:08 PM UTC jQuery 1
Tags: ejSchedule
Jens Bo Frederiksen
Asked On February 11, 2016 08:03 AM UTC


I am trying to use ejSchedule to display events for multiple resources. This works fine as long as the resource data is static (in my case loaded via DataManager). 

Now I would like to enable the user to select what resources to display as opposed to displaying all resources. Is there a way to "refresh" the schedule view and take new resource data into account?


Karthigeyan Krishnamurthi [Syncfusion]
Replied On February 12, 2016 01:08 PM UTC

Hi JensBo,

Thanks for contacting Syncfusion support.

We have prepared a sample for your requirement “Need to dynamically display the resources based on user selection“ and that can be downloaded from the following location,

In the above sample we have initially displayed all the resources and their corresponding datum. If the user uncheck/check the particular resource, the respective resource will be removed/added in the schedule control. Kindly refer to the following code example that we have used in the above sample.

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)







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;


                    resources: [{

                        field: "OwnerId",

                        title: "Owner",

                        name: "Owners", allowMultiple: true,

                        resourceSettings: {

                            dataSource: resVal,

                            text: "resText", id: "resId", color: "rescolor"







This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon