vendredi 30 janvier 2015

Kendo UI MVC Scheduler - Filter multiple ressources


Vote count:

0




I'm trying to filter the datasource Scheduler (MVC) with 2 resources: one for room and one for Attendees . I just want to filter by roomId (equal to 1) but it doesn't work: I created a filter button and I used the jquery click event to activate the filter.


I've created the following scheduler:



<button id="filter" class="k-button">Show only Room Id 1</button>

@(Html.Kendo().Scheduler<MeetingViewModel>()
.Name("scheduler")
.Date(new DateTime(2013, 6, 13))
.StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
.Height(600)
.Views(views =>
{
views.DayView();
views.WorkWeekView(workWeekView => workWeekView.Selected(true));
views.WeekView();
views.MonthView();
views.AgendaView();
})
.Timezone("Etc/UTC")
.Group(group=>group.Resources("Rooms"))
.Editable(e => e.TemplateName("SchedulerEditor"))
.Resources(resource =>
{
resource.Add(m => m.RoomId)
.Title("Rooms")
.Name("Rooms")
.DataTextField("Text")
.DataValueField("Value")
.DataColorField("Color")
.DataSource(source => source.Read(read => read.Action("GetRoomsList", "Home")));

resource.Add(m => m.Attendees)
.Title("Attendees")
.Name("Attendees")
.Multiple(true)
.DataTextField("Text")
.DataValueField("Value")
.DataColorField("Color")
.DataSource(source => source.Read(read => read.Action("GetUsersList", "Home")));
})
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.MeetingId);
m.Field(f => f.Title).DefaultValue("No title");
m.Field(f => f.Start);
m.Field(f => f.End);
m.Field(f => f.Description);
m.Field(f => f.StartTimezone);
m.Field(f => f.EndTimezone);

})
.Read("MeetingsRead", "Home")
.Create("MeetingsCreate", "Home")
.Destroy("MeetingsDestroy", "Home")
.Update("MeetingsUpdate", "Home")
)

)

<script>

$("#filter").click(function () {
var scheduler = $("#scheduler").data("kendoScheduler");

scheduler.resources[0].dataSource.filter({ field: "Value", operation: "eq", value: "1" });

scheduler.view(scheduler.view().name);
});

</script>


Can't seem to figure out why the scheduler doesn't filter by room (nothing changed on the scheduler).


I'd appreciate some help. Thanks.



asked 1 min ago







Kendo UI MVC Scheduler - Filter multiple ressources

Aucun commentaire:

Enregistrer un commentaire