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

How to show only a subset of resources when grouping

3 Answers 149 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Adrian Stovold
Top achievements
Rank 1
Adrian Stovold asked on 27 May 2009, 08:30 AM
Hi all,

I'm using custom resources to represent the venues for each appointment. I'm using a custom SchedulerProvider class inherited from DbSchedulerProviderBase. It's all working fine: when a user creates an appointment they are offered a choice of venue resources, and when I set the RadScheduler's GroupBy property to "Venue", the appointments are being grouped correctly by venue. My question is as follows:

Is it possible to show only a subset of a resource when grouping, but continue to offer the user the full resource set when creating an appointment? For example, I may have 20 venue resources, but I don't want to show them all in the main RadScheduler view: I want to use my own UI controls to allow the user to select which venue resources they want to group by. However, when the same user is creating an appointment, they will need access to the full range of venues. As far as I can see, in both situations the RadScheduler will be calling the same GetResourcesByType("Venue") function, so I'm not sure how to return a different set of resources in each case.

One idea I've had would be to create an additional, dummy resource type (e.g. "GroupingVenue") just for the purposes of grouping, then I could modify my code in GetResourcesByType("GroupingVenue") such that it return only those venues selected by the user in my UI.

If anyone can think of a more elegant way of achieving this functionality, I'd be pleased to hear from you.

Kind regards,
Adrian

3 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 27 May 2009, 02:16 PM
Hi Adrian,

There is a kb article on How to implement Resource paging. It seems like you your case is quite similar so this article could be a good starting point for you.

Let me know how it goes.


Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Adrian Stovold
Top achievements
Rank 1
answered on 27 May 2009, 04:02 PM
Many thanks, Peter. That looks promising; I'll take a look.

Kind regards,
Adrian
0
Adrian Stovold
Top achievements
Rank 1
answered on 29 May 2009, 03:07 PM
Yep, that's working great. As suggested in the KB article, I'm simply using RadScheduler.Resources.Remove() during the RadScheduler.DataBound event to remove any unwanted resources.

One possible gotcha: I found that if the user's chosen options caused me to remove ALL the resources of the type being grouped (e.g. if I'm grouping by Venue and I remove all the Venue resources) I got a JavaScript error. I've since modified my code such that it always leaves at least one resource.

Thanks again for your suggestion,
Adrian
Tags
Scheduler
Asked by
Adrian Stovold
Top achievements
Rank 1
Answers by
Peter
Telerik team
Adrian Stovold
Top achievements
Rank 1
Share this question
or