Scheduler Timelineview : Add new row dynamically

Hi Support team,

We are currently binding the scheduler from the JSON object.

The requirement is as follows:

  1. After proper binding, when a button on the page is pressed, a new row needs to be added at the top of the timeline (which is already loaded from JSON) with ‘XYZ’ (as text) in the left column.
  2. For this new row, a timeslot needs to be included dynamically (the data will be available for the timeslot - startdate, enddate, etc.)
  3. This should work dynamically on every click of the button. i.e. on each button click, a new row and its related timeslot needs to be created.
  4. The already loaded scheduler data should remain as it is and these new rows needs to be included at the top of data.

Could you please provide any example or details of how shall we achieve this?

Thanks.

Hi,

I did something similar with my implementation of my Timeline Views. I thought I’d share what I did.

Basically, on the timeline view declaration, do the following:

scheduler.createTimelineView({
	name:    'timelineDay',
	y_unit:  scheduler.serverList('sectionsArray', yourArrayOfSectionsOnTheLeftSide),
	...
	...
	...
});

Notice the first parameter in your y_unit. You can just update that using updateCollection method. So, in your function, you can do this:

function updateTimelineSectionsWithButtonClick () {
	...update yourArrayOfSectionsOnTheLeftSide here...

	scheduler.updateCollection('sectionsArray', yourArrayOfSectionsOnTheLeftSide);
	scheduler.updateView();
}

Basically, both the string you pass on the first parameter and the variable of your array for the second parameter for both the timeline declaration of y_unit and updateCollection should be the same.

Hope this helps.

Hi jiminee,

Thank you for the help. The provided example worked as per the requirement!