This is a migrated thread and some comments may be shown as answers.

Remove unnecessary request

3 Answers 74 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 15 Mar 2018, 04:08 PM

Hi, 

I'm trying to make scheduler in which you could remove group like in example(https://demos.telerik.com/aspnet-mvc/scheduler) also remove that group name from calendar view, i'm doing it by filtering the datasource of resource.

But then i need to use scheduler.view(scheduler.viewName()) to repaint calendar and it makes post to get information to server. I would like to remove this unnecessary request, because i'm getting data via filter button and on scheduler navigate.

Is there any way to remove unnecessary request.

I'm attaching the modified view file from example package.

 

3 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 19 Mar 2018, 09:06 AM
Hi Peter,

To avoid the additional server call, I would suggest you to prevent the read in the requestStart event handler of the DataSource:
.DataSource(d => d
    .Events(e => e.RequestStart("onRequestStart"))
    .ServerOperation(true)
    .Model(m => {
m.Id(f => f.TaskID);
.............

and:
function onRequestStart(e) {
  if (preventRead) {
    preventRead = false;
    e.preventDefault();
  }
}

where the reventRead is a globally available flag set to true in the checkbox change handler:
var preventRead = false;

$(
"#people :checkbox").change(function(e) {
    var scheduler = $("#scheduler").data("kendoScheduler");
 
    var filter = {
        operator: item => $.inArray(
            item.Value,
            $("#people :checked").map((index, person) => parseInt($(person).val()))
        ) >= 0
    }
 
    preventRead = true;
 
    scheduler.resources[0].dataSource.filter(filter);
    scheduler.view(scheduler.viewName());
});

Regards,
Veselin Tsvetanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Peter
Top achievements
Rank 1
answered on 30 Mar 2018, 09:00 AM

Thanks Veselin for reply.

As we implemented this functionality the calendar looses all his displayed data.

0
Veselin Tsvetanov
Telerik team
answered on 03 Apr 2018, 06:18 AM
Hello Peter,

May I ask you to prepare and send us a small isolated runnable sample revealing the issue observed? This way we will be able to troubleshoot the problem locally and to provide you with the most appropriate assistance for this case.

Regards,
Veselin Tsvetanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Peter
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Peter
Top achievements
Rank 1
Share this question
or