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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I insert new resource in a Schedule control from the client side?

Thread ID:

Created:

Updated:

Platform:

Replies:

128934 Feb 16,2017 04:50 PM UTC Feb 20,2017 12:28 PM UTC ASP.NET MVC 3
loading
Tags: Schedule
Cornel Amarandei
Asked On February 16, 2017 04:50 PM UTC

Hi,

I have a Schedule control grouped horizontally like in this demo: http://mvc.syncfusion.com/demos/web/schedule/horizontalresourcegrouping.

I want to insert from the client side a new resource, for example to add "John" to "ROOM2".

Thanks,
Cornel.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On February 17, 2017 11:43 AM UTC

Hi Cornel, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared the sample to dynamically add the resource which can be download from the below location. 
 
In the above sample, when a button is clicked, new resource will be added to the Scheduler. Kindly refer the below code example used in the sample. 
 
<Code> 
$("#BindData").click(function () { 
        var resData = [{ text: "Oliver", id: "4", groupId: "2", color: "#ffaa00" }]; 
        var schObj = $("#Schedule1").data("ejSchedule"); 
        schObj.model.resources[1].resourceSettings.dataSource.push(resData[0]); // here we are dynamically adding the resource 
        var resVal = schObj.model.resources[1].resourceSettings.dataSource; // here total no of resources will be stored 
        var modelRoomData =  @Html.Raw(Json.Encode(ViewBag.Rooms)); // here we are getting the Room data collection from controller 
        var modelAppData =  @Html.Raw(Json.Encode(ViewBag.datasource));  
        var AppData = []; 
        for (var i = 0; i < modelAppData.length; i++) { 
            AppData[i] = { 
                Id: modelAppData[i].Id, 
                Subject: modelAppData[i].Subject, 
                StartTime: new Date(modelAppData[i].StartTime.match(/\d+/)[0] * 1), 
                EndTime: new Date(modelAppData[i].EndTime.match(/\d+/)[0] * 1), 
                AllDay: modelAppData[i].AllDay, 
                Recurrence: modelAppData[i].Recurrence, 
                RecurrenceRule: modelAppData[i].RecurrenceRule, 
                OwnerId:modelAppData[i].OwnerId, 
                RoomId:modelAppData[i].RoomId 
            } 
        } 
        ------------ 
        ------------ 
    }); 
</Code> 
 


Cornel Amarandei
Replied On February 17, 2017 12:01 PM UTC

Hi Karthigeyan,

Thanks for your information. It works very well.

Regards,
Cornel.

Mahesh Palanisamy [Syncfusion]
Replied On February 20, 2017 12:28 PM UTC

Hi Cornel, 
 
We are glad to hear that our provided solution worked well at your end. 

Kindly let us know, if you need any further assistance on this. 

Regards, 
Mahesh 


CONFIRMATION

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

or the page will be automatically redirected to 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

;