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

Specify limits on data to pull from datasource.

8 Answers 63 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Veteran
Jason asked on 25 Jul 2019, 06:32 PM

I am setting up a scheduler which will always be in Month view, and want to only pull data from my database for the displayed month, reading from the database when a new month is selected. I am anticipating sending my controller the selected date in my datasource.Read call, and when the arrows at the top are clicked to select a new month, another read is performed.

How would I go about doing this?

8 Answers, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 29 Jul 2019, 01:36 PM
Hello Jason,

Please check this "Filter Events on Server between Start and End of the Current View"demo project from our documentation. It demonstrates exactly what you want to be achieved. 

If you have any questions regarding the implementation, please let me know. 

Regards,
Petar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jason
Top achievements
Rank 1
Veteran
answered on 29 Jul 2019, 08:20 PM

That looks good! I'll give it a try.

Is there a way to use the HTML helper instead of javascript?

0
Jason
Top achievements
Rank 1
Veteran
answered on 29 Jul 2019, 08:27 PM
I'm also using custom resources, as I need to color entries in the month view. I already have this working using the HTML helper.
0
Jason
Top achievements
Rank 1
Veteran
answered on 29 Jul 2019, 10:21 PM

So this is what I was able to get working, however as I mentioned above, I'd like to use the Razor HTML helper for consistancy.

01.<div id="scheduler"></div>
02. 
03.<script>
04.    $(function() {
05.        $("#scheduler").kendoScheduler({
06.            views: [
07.                { type: "month", selected: true },
08.            ],
09.            resources: [{
10.                dataSource: {
11.                    transport: {
12.                        read: {
13.                            url: "@Url.Action("List", "Lab")"
14.                        }
15.                    },
16.                    schema: {
17.                        model: {
18.                            id: "Id",
19.                            fields: {
20.                                Id: {
21.                                    "type": "number"
22.                                },
23.                                Name: {
24.                                    "type": "string"
25.                                },
26.                                Color: {
27.                                    "type": "string"
28.                                }
29.                            }
30.                        }
31.                    }
32.                },
33.                title: "Lab",
34.                field: "LabId",
35.                dataTextField: "Name",
36.                dataValueField: "Id",
37.                dataColorField: "Color"
38.            }],
39.            dataSource: {
40.                transport: {
41.                    read: {
42.                        url: "@Url.Action("List", "Calendar")",
43.                        dataType: "json",
44.                        contentType: "application/json; charset=utf-8",
45.                        type: "POST"
46.                    },
47.                    parameterMap: function (options, operation) {
48.                        if (operation === "read") {
49.                            var scheduler = $("#scheduler").data("kendoScheduler");
50.                            var result = {
51.                                start: scheduler.view().startDate(),
52.                                end: scheduler.view().endDate()
53.                            }
54.                            return kendo.stringify(result);
55.                        }
56.                        return kendo.stringify(options);
57.                    }
58.                },
59.                serverFiltering: true,
60.                schema: {
61.                    model: {
62.                        id: "taskID",
63.                        fields: {
64.                            taskID: { from: "TaskID", type: "number" },
65.                            title: { from: "Title", defaultValue: "No title", validation: { required: true } },
66.                            start: { type: "date", from: "Start" },
67.                            end: { type: "date", from: "End" },
68.                            startTimezone: { from: "StartTimezone" },
69.                            endTimezone: { from: "EndTimezone" },
70.                            description: { from: "Description" },
71.                            recurrenceId: { from: "RecurrenceID" },
72.                            recurrenceRule: { from: "RecurrenceRule" },
73.                            recurrenceException: { from: "RecurrenceException" },
74.                            ownerId: { from: "OwnerID", defaultValue: 1 },
75.                            isAllDay: { type: "boolean", from: "IsAllDay" },
76.                            LabId: { from: "LabId", type: "number" }
77.                        }
78.                    }
79.                }
80.            }
81.        });
82.    });
83.</script>
0
Petar
Telerik team
answered on 31 Jul 2019, 03:32 PM
Hello Jason,

We are currently working on your case but we will need more time to answer you. I will contact you back in the next 24 hours. 

Regards,
Petar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Petar
Telerik team
answered on 01 Aug 2019, 11:43 AM
Hi Jason,

Thank you for your patience. 

Please accept my apologies for sending you the wrong project. The provided Scheduler component could be implemented with Razor HTML helper. Refer to the below-linked example that demonstrates the desired server filtering implementation using HTML helper:

https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/scheduler/scheduler-server-filtering

You could also find useful these Scheduler’s demos from our product page. 

Please try implementing the Scheduler following the provided above information and let me know if have any questions or need further assistance. 

Regards,
Petar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jason
Top achievements
Rank 1
Veteran
answered on 02 Aug 2019, 02:39 AM
Perfect, I will give that a try this week.
0
Petar
Telerik team
answered on 05 Aug 2019, 12:47 PM
Hi Jason,

Take your time to test the proposed approach. Let me know if you need further assistance with the current issue. 

Regards,
Petar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Scheduler
Asked by
Jason
Top achievements
Rank 1
Veteran
Answers by
Petar
Telerik team
Jason
Top achievements
Rank 1
Veteran
Share this question
or