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

How to set scheduler grouping resource to custom resource, not the scheduler resource?

4 Answers 647 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 04 Apr 2017, 10:53 PM

I am wondering if it is possible to group resources vertically that are not part of the scheduler resources... 

I saw that I can specify 'group: {orientation: 'vertical', resources: ['OwnerName']}' in my timeline view that I want this displayed this way in, which utilizes the 'text' field of all the javascript objects in my resource named 'OwnerName', which is the resource list that is set to my scheduler resources option.

 

However, my scheduler resources have items that I don't want shown on my timeline grouping (like groups and various rooms). I only want the users from the list, so tried creating a new resource item and setting my group:{resources: newResource} but nothing happened.

 

How can I apply vertical grouping of resources, but use a custom resource item that is not the resources of the scheduler?

4 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 06 Apr 2017, 11:14 AM
Hello Tyler,

I am not quite sure about what exactly you mean by loading the resources that are not part of the Scheduler resources. If the widget is not supplied with the needed  of the resources it cannot load them. Could you please elaborate a bit more on that matter, in case if I had misunderstood your scenario.

As for the "my resources have items that I don't on my timeline grouping (like groups and various rooms)", I can suggest refer to the following online demo, demonstrating how to hide/show resources programmatically, base on the checked  (under the images):

http://demos.telerik.com/kendo-ui/scheduler/index


Regards,
Nencho
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Tyler
Top achievements
Rank 1
answered on 06 Apr 2017, 01:46 PM

My issue with the provided example is that my scheduler has gotten fairly complicated filtering and functionality where I have a multi-select user filter instead of checkboxes. The user filter has groups, resources, and users that are all filterable. However, on the timeline view, I want to show only the users that are selected going down vertically. If I do grouping with my current resources in the scheduler, it contains resources and groups along with users, and shows all users and what not instead of what is selected in the filter. 

 

So my thought was creating a new resource item that is identical to the resources passed to the scheduler, but the dataSource data is restricted to exactly what I want. But when setting my grouping resources to this new resource item, nothing would show up. 

 

Perhaps this is beyond the functionality of the scheduler and I can't do this? Would it be possible programatically, like manually creating swim lanes for each desired user going down vertically when switching to the timeline view... if so, how would this be done?

 

Trying to achieve grouping like this: http://demos.telerik.com/kendo-ui/scheduler/resources-grouping-vertical 

without the 'meeting room 1' and 'meeting room 2' and just with the users, but not including everything in my resources that were passed to the scheduler.

0
Tyler
Top achievements
Rank 1
answered on 07 Apr 2017, 08:07 PM

So I have this in my navigate event in my scheduler:

 

if(e.view.substring(0, 8).toLowerCase() == 'timeline'){
                                        console.log('Users In Filter: ', filteredDataSource);
                                        scheduler.resources[0].dataSource.data(filteredDataSource);
                                        //scheduler.view(scheduler.view().name);
                                        //scheduler.resources[0].dataSource.read();
                                        console.log('Switching to timeline', scheduler.resources[0].dataSource.data());
                        }else{
scheduler.resources[0].dataSource.data(userResource);
                                        //scheduler.view(scheduler.view().name);
                                        //scheduler.resources[0].dataSource.read();
                                    }

 

where userResource is my list of all users and fitleredDataSource are just users that are currently in the user filter. This works just fine in displaying only users selected in the filter in my timeline views when I choose them from any view that is not a timeline view, THEN navigate to the timeline view... But while in the timeline view, if I select another person to put in the user filter or get rid of someone, I get the 'Cannot read property "_continuousEvents" of undefined' when I am doing this in my change event of the multi select that is the user filter:

filteredDataSource = this.dataItems();
                        console.log('User Resources', userResource);
                        console.log('Filtered DataSource', filteredDataSource);
                        if(filteredDataSource.length == 0){
                            console.log('User filters not specified, showing all users');
                            filteredDataSource = userResource;
                        }
                        if(scheduler.viewName().substring(0, 8).toLowerCase() == 'timeline'){
                            console.log('Inside timeline view!');
                            scheduler.resources[0].dataSource.data(filteredDataSource);
                            //scheduler.view(scheduler.view().name);
                            //scheduler.resources[0].dataSource.read();
                        }

 

Doing scheduler.view(scheduler.view().name) after prevents the error, but it fails to populate the scheduler with the new events it has grabbed, like the dataSource of the scheduler isn't actually reading, it just gives me the events I HAD before adding or removing anyone from the user filter, so updating the view like that doesn't work for my purposes. 

I am not really sure what the error is or how to prevent it and change resources as needed. I have my views for my scheduler set up like:

{type: "day", startTime: new Date(1901, 1, 1, 0, 0, 0), endTime: new Date(1901, 1, 1, 23, 59, 59)},
                        {type: "week", startTime: new Date(1901, 1, 1, 0, 0, 0), endTime: new Date(1901, 1, 1, 23, 59, 59), selected: true},
                        {type: "workWeek", startTime: new Date(1901, 1, 1, 0, 0, 0), endTime: new Date(1901, 1, 1, 23, 59, 59)},
                        {type: "month"},
                        {type: "agenda", eventTemplate: $('#agendaEventTemplate').html()},
                        {type: AgendaDayView, title: 'Day Agenda', eventTemplate: $('#agendaEventTemplate').html()}, 
                        {type: "timeline", startTime: new Date(1901, 1, 1, 0, 0, 0), endTime: new Date(1901, 1, 1, 23, 59, 59), group: {orientation: 'vertical', resources: ['OwnerName']}},
                        {type: "timelineWeek", startTime: new Date(1901, 1, 1, 0, 0, 0), endTime: new Date(1901, 1, 1, 23, 59, 59), group: {orientation: 'vertical', resources: ['OwnerName']}},
                        //{type: "timelineWorkWeek", startTime: new Date(1901, 1, 1, 0, 0, 0), endTime: new Date(1901, 1, 1, 23, 59, 59), group: {orientation: 'vertical', resources: ['OwnerName']}}
                        {type: "timelineMonth", startTime: new Date(1901, 1, 1, 0, 0, 0), group: {orientation: 'vertical', resources: ['OwnerName']}}

so only my timeline views have grouping

0
Nencho
Telerik team
answered on 10 Apr 2017, 10:33 AM
Hello Tyler,

Indeed the Scheduler does not support this scenario by design. However, I can suggest referring to the following forum thread, where the similar topic is discussed and the same error is thrown. In addition, the client who experienced this error in the same timelineView had provided the solution that worked for him:

http://www.telerik.com/forums/dynamically-refreshing-resources-and-schedule-events-in-timeline-view


Hope this would help.

Regards,
Nencho
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Scheduler
Asked by
Tyler
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Tyler
Top achievements
Rank 1
Share this question
or