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

Scheduler: Combine server filtering with dynamic loaded resources

1 Answer 147 Views
This is a migrated thread and some comments may be shown as answers.
Steffen
Top achievements
Rank 1
Steffen asked on 28 Nov 2018, 09:25 AM

Hello,

i am currently evaluating kendo ui and i am in a struggle while implementing the following:

Since i have many resources and events i want to use server filtering.

The example from the link below works great for event filtering.
https://docs.telerik.com/kendo-ui/controls/scheduling/scheduler/how-to/filtering/server-filtering


My problem is i would need the resources also to load dynamically from a datasource(with start/end set parameters)
But since the resources seems to be loaded before the scheduler view seems to be ready i do not have the start/end variables.

Changing the resources after the scheduler is loaded and perform a scheduler.refresh does not work.
It is showing the changed resources only after an action on the scheduler (change view, click on today)

Do you have any hints for this?

Thank you and best regards, Alex

1 Answer, 1 is accepted

Sort by
0
Accepted
Veselin Tsvetanov
Telerik team
answered on 30 Nov 2018, 07:45 AM
Hello Alex,

You are correct. In order to filter properly the resources in the Scheduler, you will have to wait for the view to be initially loaded. Then you should force read on the resource DataSource and after the response has been received, you should reset the view:
var dataSource = scheduler.resources[0].dataSource;
dataSource.one("change", function() {
    scheduler.view(scheduler.view().name);
});
dataSource.read();

Similarly to the events server filtering scenario, you should pass the start and end date along the resource Read request, so you will be able to filter them on the server.

To properly catch the moment, when the Scheduler view has been loaded and the start and end dates are known, you could use the Scheduler dataBound event. In order to prevent an endless loop, you could use a flag, which would be set to true in the navigate event of the widget. Only in that case the Read on the resources DataSource should be forced.

Regards,
Veselin Tsvetanov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Steffen
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or