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

How to Refresh Scheduler when NOT using JSON functionality?

7 Answers 120 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 15 Nov 2015, 05:45 AM

I am working on a C# MVC (5.2.2) App using Kendo.MVC 2015.3.930.545 (VS 2013 .NET 4.5.1) 

Obviously I would like to be able to refresh/update the scheduler when changing the date(s).  I am not using the JSON-based functions as the demos use.  For my other Telerik controls, the same holds true.  That is, I use plain/vanilla server calls to the server instead.  I do capture some events using JS and do make AJAX calls to refresh data where/when applicable.  I would like to use this approach for the Scheduler but I need help w/this control.

In this case, I would like to know how I can capture the change of dates.  I am not able to use the "Navigate" event nor .Data() for the .DataSource's .Read() method in my code (am I missing some lib? dll?):

 

Here is my Scheduler control in my .cshtml file:

@(Html.Kendo().Scheduler<EPIMS.Models.TaskViewModel>()
    .Name("scheduler")
    .Date(System.DateTime.Today)
    .StartTime(new DateTime(System.DateTime.Now.Year,System.DateTime.Now.Month,System.DateTime.Now.Day, 5, 00, 00))
    .Height(600)
    .Views(views =>
    {
        views.DayView(dayView => dayView.Selected(true));
        views.WorkWeekView();
        views.WeekView();
        views.MonthView();
    })
    .Timezone("Etc/UTC")
    .DataSource(d => d
        .ServerOperation(true)
        .Read("Details", "Inspections").Data()
        //.Read(read => read.Action("Details", "Inspections"))
        .Create("Create", "Inspections")
        .Destroy("Deactivate", "Inspections")
        .Update("Edit", "Inspections")
        .Events(e => 
        {
            e.Change("schedulerChange");
            e.Navigate
        })
    )
    .BindTo(Model)
)

 The "Navigate" event is not available nor is the .Data() item for the .Read() method (for DataSource).

I get this error @ runtime for the .Data() item:

Compiler Error Message: CS1061: 'Kendo.Mvc.UI.Fluent.SchedulerAjaxDataSourceBuilder<EPIMS.Models.TaskViewModel>' does not contain a definition for 'Data' and no extension method 'Data' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.SchedulerAjaxDataSourceBuilder<EPIMS.Models.TaskViewModel>' could be found (are you missing a using directive or an assembly reference?)

 

and this error @ runtime for the e.Navigate event:

Compiler Error Message: CS1061: 'Kendo.Mvc.UI.Fluent.DataSourceEventBuilder' does not contain a definition for 'Navigate' and no extension method 'Navigate' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.DataSourceEventBuilder' could be found (are you missing a using directive or an assembly reference?)

 

Am I using old API calls?  How can I capture the change of dates?

Thanks,

 

 ‚Äč

7 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 17 Nov 2015, 11:27 AM
Hello Aaron,

If you look closely in the official demo for server filtering you will notice that the "Data" method is available only after the "Action" method:

.Read(read => read.Action("Read", "Home").Data("getAdditionalData"))

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 17 Nov 2015, 04:39 PM

I did look closely.  It just so happened that the code that I posted was not completely accurate. My apologies for that.

 Nonetheless, here is the actual line of code:

 

Line 104: .DataSource(d => d

Line 105: .ServerOperation(true)

Line 106: .Read(read => read.Action("Details", "Inspections")).Data("getAdditionalData")

 

And here is the error:

Compiler Error Message: CS1061: 'Kendo.Mvc.UI.Fluent.SchedulerAjaxDataSourceBuilder<EPIMS.Models.TaskViewModel>' does not contain a definition for 'Data' and no extension method 'Data' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.SchedulerAjaxDataSourceBuilder<EPIMS.Models.TaskViewModel>' could be found (are you missing a using directive or an assembly reference?)

0
Vladimir Iliev
Telerik team
answered on 18 Nov 2015, 10:29 AM
Hello Aaron,

The issue is still related to the invalid configuration in the provided code:

INVALID:
.Read(read => read.Action("Details", "Inspections")).Data("getAdditionalData")

VALID:
.Read(read => read.Action("Details", "Inspections").Data("getAdditionalData"))

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 18 Nov 2015, 04:14 PM

Very well.  Thanks for that clarification.  An obvious oversight on my part.

Now, there is still the matter of how to capture the change of dates?  I am trying to understand how the Scheduler's "Read" function works.  Is this the function that should be used to read from the DB (in the server) to refresh/update the Scheduler when the dates change?

0
Vladimir Iliev
Telerik team
answered on 19 Nov 2015, 11:12 AM
Hello,

When you set the "ServerOperation" option of the Scheduler DataSource to "true", each time you navigate to different date or view the Scheduler will automatically call the "Read" action with the additional data from the custom "Data" function that you are using.

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 22 Nov 2015, 06:34 PM

Thanks. I truly appreciate your time and attention.  A few more items howver.

I am seeing the call back to the server's "Read" action on navigate (i.e .change of date).  It is worth noting that the "Read" action in this case is NOT defined/declared as "public virtual JsonResult" like in the demos.  Rather the action is defined/declared as "public ActionResult" which returns a View (the "Read" view to be specific).

Upon initial load of the "Read" page, the task for the default date (i.e. today) IS displayed.

However, the data is not getting refreshed when I navigate to a different date (i.e. yesterday) w/a scheduled task, nor when I navigate back to "Today".

Additionally, when I click on the displayed task, I get a view (possible "Details") in a pop-up window.  However, when I click on the cancel button, the window is closed and the task is not longer visible in the "Read" view.

0
Accepted
Vladimir Iliev
Telerik team
answered on 23 Nov 2015, 08:30 AM
Hello Aaron,

Please note that the CRUD operation defined in the Scheduler DataSource should return JSON response and not views. That why I would suggest to define new action which to be different than the one used for loading the view and return JSON response as shown in our documentation and demos. 

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Aaron
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Aaron
Top achievements
Rank 1
Share this question
or