Scheduler refresh

5 posts, 1 answers
  1. James
    James avatar
    9 posts
    Member since:
    Feb 2016

    Posted 07 Feb Link to this post

    Hi guys,

     

    in my scenario I show only one day - view as we  use the scheduler for building complex agendas with many rooms. When an user adds (or edits existing event) at the bottom of the custom edit box is an option to move the session to another day. If user selects other day and clicks on the save button on the controller we change start/end date of the session and save that to the database 

     

     var item = eventService.GetAgendaDay(sesssion.EventAgendaDayId); //selected id of the another day

    //changing start/end date 
                    sesssion.Start = new DateTime(item.Date.Year, item.Date.Month, item.Date.Day, sesssion.Start.Hour, sesssion.Start.Minute, sesssion.Start.Second);
                    sesssion.End = new DateTime(item.Date.Year, item.Date.Month, item.Date.Day, sesssion.End.Hour, sesssion.End.Minute, sesssion.End.Second);

     and once we perform the save option we return the session back

     

     return Json(new[] { sesssion }.ToDataSourceResult(request, ModelState));

     

    At this moment, the newly created session/or edited belongs to the another day and it should not be visible anymore on the screen, but it is. that is reason why I'm asking how to manualy refresh the source after save

     

    thanks

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 09 Feb Link to this post

    Hi James,

    I'm not sure that I understand correctly what is the exact scenario that you have - could you please provide small runable example where the issue is reproduced? This would help us get better overview of the exact setup that you have and advice you better how to proceed. 

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. James
    James avatar
    9 posts
    Member since:
    Feb 2016

    Posted 09 Feb in reply to Vladimir Iliev Link to this post

    Hi Vladimir,

     

    I think I went into too much details in my first post and I can't expose any part of the solution due privacy agreement with the client.

     

    Let me try to rephrase my question 

     

    In short: we need to refresh manually the scheduler's datasource once a new event has been saved. So user clicks on the scheduler we fire add/edit event custom window, User enters details about the event, clicks on the save button, browser submits data to the controller, controller saves it and returns 

    return Json(new[] { task }.ToDataSourceResult(request, ModelState)); back to the browser 

     

    At this point we want to manually refresh data source via javscript. Is there an event that that we can use? We tried with .Events(a=>a.Save("somemethod")) but this event fires before submitting data to the controler 

     

     

  5. Answer
    Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 10 Feb Link to this post

    Hi James,

    You can utilize the "Save" event of the Scheduler to track next "DataBinding" event where to call the "read" method of the DataSource:

    function onSave(e) {
        this.one("dataBinding", function(e) {
            e.preventDefault();
            this.dataSource.read();
        });
    }

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. James
    James avatar
    9 posts
    Member since:
    Feb 2016

    Posted 10 Feb in reply to Vladimir Iliev Link to this post

    This is exactly what I needed. Thank you so much!
Back to Top
Kendo UI is VS 2017 Ready