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

Customizing groupping

9 Answers 132 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Daní
Top achievements
Rank 1
Daní asked on 14 Jun 2012, 01:52 PM
Hello,

First of all, it's the first time I use ScheduleView control and I think it's an amazing control with a lot of exciting features, highly customizable and great perfomance.

Now, I'm trying to customize grouping to my needs. I'll try to explain my scenario:

I want to use ScheduleView control to allow Administrative user to schedule appointments for patients. Each appointment is served by a "treatment unit". A treatment unit is formed by several doctors. Each doctor has a predifiend agenda so, for example, "Doctor A" works every monday and wednesday from 8:00 AM to 2:00 PM. Each agenda is divided on predefined "slots" of 10 minutes of duration.

In my application, when scheduler is loaded in view for an specific agenda, app downloads the current doctor's agenda. I'm considering agenda's doctor slots as appointments (a custom implementation with a boolean property to set if slot is free or busy). User can double click on any "free" appointments (slot) to schedule the current appointment. 

As I'm only interested in availables doctor's agenda dates, I created a custom WeekViewDefinition. So, following the example of "Doctor A", FirstDayOfWeek property will be Monday and VisibleDays property will be 3 in my cistom WeekViewDefinition. Thats works quite fine except that in this case I'm seeing "Tuesdays" on WeekViewDefinition when Tuesdays are not available dates. Is there any way to only show Mondays and Wednesdays on WeekViewDefinition?

This is even worst when grouping. User's can add doctor agendas. I have create a GroupDescription base on Doctor's id. So users can select to see more than on agenda. For example, if user selects to see Doctor's A Agenda (who only works Mondays and Wednesday) and Doctor's B agenda (who only works Mondays and Saturdays) the Week view shows, for each doctor, from monday to saturday. I'd like that when grouping, Doctors A group only shows Monday and Wednesday and Doctor's B group only shows Monday and Saturday,

Can I achieve this functionality?

9 Answers, 1 is accepted

Sort by
0
Lancelot
Top achievements
Rank 1
answered on 15 Jun 2012, 07:59 PM
Hi Dani,

 You can create custom visible ranges. Go to this documentation and see how you can access the ViewDefinitionBase class. There also view specific properties you can change for DayView and WeekView, this document shows you how to add customization there.

I hope this helps you, explore the new documentation while you're there. Good Luck!

Lancelot
0
Daní
Top achievements
Rank 1
answered on 18 Jun 2012, 07:21 AM
Thanks Lancelot for your answer,

I also read these articles but these customization doesn't fit my needs. I need to go further with view definitions. I don't want to define a range o visible day but I need to define "discrete" visible days, so I'd need, for example, that only Tuesdays and Thursdays are visible. Following the documentation I've been able to set in my custom WeekViewDefinitions that FirstDayOfWeek is Tuesday and VisibleDays are 3, but in this case Wednesday appears in View.

0
Daní
Top achievements
Rank 1
answered on 18 Jun 2012, 02:06 PM
Hi,

It's being hard to customize WeekViewDefinitiion. I've tried to override the PrepareContainerForItemOverride in my Custom WeekViewDefinition. Using Silverlight Spy I could observe that RadScheduleView paints items in a AppointmentsPannel. AppointmentsPannel children are of type GroupHeader o AppointmentItem. Foreach GroupHeader the methos PrepareContainerForItemOverride is called in the RadScheduleView's ActiveViewDefinition.

So, in my custom WeekViewDefinition I overrided the PrepareContainerForItemOverride  method. In this method, I can know if the item to prepare should be visibible, if not, I set the item's Visibility property to Collapsed. This works partially as the header of the date does not appears but still appears the space reserved for the group header.

Any help?
0
Ivo
Telerik team
answered on 19 Jun 2012, 01:07 PM
Hello Dani,

I would suggest you to check the GroupFilter functionality provided by the RadScheduleView. You can find an example of it into our online examples. Using it you will be able to filter the displayed dates into the WeekViewDefinition using your own custom filter.

Regards,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Daní
Top achievements
Rank 1
answered on 20 Jun 2012, 11:31 AM
Hi Ivo. Thanks for your answer.

It's very closed to what I need. The only problem is about dates sorting. Sometimes, when changing groups filter, date are not correctly sorted. Let's suppose the nex example:

I have three agenda for Doctor A, Doctor B and Doctor C. Doctor A only works Mondays from 8:00 AM to 2:00 PM. Doctor B only works Tuesdays from 8:00 AM to 2:00 PM too and, finally, Doctor C only works Thursdays from 8:00 AM to 2:00 PM.

Firstly, the only selected agenda is the Doctor A's. So, my GroupFilter implementation only allows Monday dates. If then users selects to view Doctor A and Doctor C agendas, only Mondays and Thursday dates are visible. Finally, users selects to view all agendas, so only Mondays, Tuesdays and Thursdays are visible. That's great except that Thursdays appear before Tuesday, the appearance order, in this case, is Monday, Thursday and finally Tuesday. I've tried to sort the Appintments source by Start date with no success.
Any Idea?

Another issue related to group filters. I have set the ScheduleView GroupDescriptionsSource as follows:

<telerik:RadScheduleView.GroupDescriptionsSource>
  <telerik:GroupDescriptionCollection>
    <telerik:DateGroupDescription/>
    <telerik:ResourceGroupDescription ResourceType="Agenda" ShowNullGroup="False"/>
  </telerik:GroupDescriptionCollection>
 </telerik:RadScheduleView.GroupDescriptionsSource>

So first group is a DateGroupDescription and second Group is ResourceGroupDescription where Resource Type is the Agenda (doctor's id).

With this setting, for each visible date (those who passes the GroupFilter) I can see all the selected doctors agenda. In the above example, if Doctor A, Doctor B and Doctor C are selected I can see in the ScheduleView (with WeekView):

Monday
Doctor A
Doctor B
Doctor C
Tuesday
Doctor A
Doctor B
Doctor C
Thursday
Doctor A
Doctor B
Doctor C
I'd like to filter Doctor's group to only see the Doctor's Group in days when doctor's agenda is available, In my example that shuld be:
Monday
Doctor A
Tuesday
Doctor B
Thursday
Doctor C
Any Idea?
0
Daní
Top achievements
Rank 1
answered on 25 Jun 2012, 08:02 AM
Hi,

finally I could solve the problem related to dates sorting. Now all dates are shown in correct order.

I still need a way to filter ResourceGroups inside a date group. I've set a breakpoint on the GroupFIlter function and I've seen that the method is invoked several times for each visible date anf for each ResourceGroup. However, I'm not able to to relate the ResourceGroup wiht a date. Any idea?
0
Ivo
Telerik team
answered on 25 Jun 2012, 12:41 PM
Hi Dani,

I fear that you will not be able to show different dates for different resources using the current version of RadScheduleView for Silverlight. This could be achieved by displaying different RadScheduleViews for different resources and use custom templates to make all the RadScheduleViews look like a single one.

All the best,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Daní
Top achievements
Rank 1
answered on 26 Jun 2012, 11:22 AM
Hi Ivo,

It's really a shame not being able to filter "nested" resource groups based on their "parent" group. 

I've tried to override the PrepareContainerForItemOverride method in my custom WeekViewDefinition. At this point I have all the needed info of the item (its group and its parent group) and I've tried to set the Visibility property to "Visible" or "Collapsed" depending on my filter criteria. I can collapse the undesired GroupHeaders control but the RadScheduleView still shows the "slots" for the group. It seems that the inner panel does'nt have in account the GroupHeader's Visibility and it "reserves" the space for it.

Your proposed solution looks a bit complex and maybe slow in performance terms as many RadScheduleViews instance can be instantiated. 
0
Ivo
Telerik team
answered on 27 Jun 2012, 07:50 AM
Hi DanĂ­,

We will consider this feature for one of our future releases. You are right that the proposed solution early is complex, but I think it may be the only way to achieve this.

Regards,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
Daní
Top achievements
Rank 1
Answers by
Lancelot
Top achievements
Rank 1
Daní
Top achievements
Rank 1
Ivo
Telerik team
Share this question
or