Reputation: 6850
I'm trying enable/disable grouping in KendoUI Scheduler at the users command. I'm using the MVC version of the program, and I've got a basic schedule up and working.
The code below will group my schedule horizontally using the ResourceID value. I would like to create a button that will turn this grouping on or off.
@(Html.Kendo().Scheduler<Web.Models.Calendar.CalendarActivity>()
.Name("scheduler")
.Date(today)
.StartTime(new DateTime(2013, 11, 01, 10, 00, 00))
.EndTime(new DateTime(2013, 11, 29, 23, 00, 00))
.Editable(false)
.Height(600)
.BindTo(Model)
.Editable(true)
.MinorTickCount(4)
.Views(views =>
{
views.DayView();
views.WeekView(weekView => weekView.Selected(true));
views.MonthView();
views.AgendaView();
})
.Group(g => g.Resources("ResourceID").Orientation(SchedulerGroupOrientation.Horizontal))
.Resources(resource =>
{
//specify the field from the model which contains the resource id
resource.Add(m => m.ResourceID)
.Title("Name")
.DataTextField("Name")
.DataValueField("Id")
.DataColorField("Color")
.BindTo(ViewBag.Resources);
})
)
Upvotes: 1
Views: 315
Reputation: 20203
You cannot dynamically change groups - add or remove them, you will need to re-initialize the whole Scheduler
Upvotes: 3