Remove unnecessary request

4 posts, 0 answers
  1. Peter
    Peter avatar
    7 posts
    Member since:
    Oct 2014

    Posted 15 Mar 2018 Link to this post

    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.

     

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1230 posts

    Posted 19 Mar 2018 Link to this post

    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.
  3. Peter
    Peter avatar
    7 posts
    Member since:
    Oct 2014

    Posted 30 Mar 2018 Link to this post

    Thanks Veselin for reply.

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

  4. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1230 posts

    Posted 03 Apr 2018 Link to this post

    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.
Back to Top