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

Group by viewdefinitions

1 Answer 89 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Sebastien
Top achievements
Rank 1
Sebastien asked on 27 Nov 2013, 10:04 PM
Hello,
I currently group data as follow:

<telerik:RadScheduleView.ViewDefinitions>

<telerik:DayViewDefinition Title="{res:Res Static=loc:ResourceIntervention.DayPlanning, Default='Jour!'}"/>

<telerik:WeekViewDefinition Title="{res:Res Static=loc:ResourceIntervention.WeekPlanning, Default='Semaine!'}"/>

<telerik:MonthViewDefinition Title="{res:Res Static=loc:ResourceIntervention.MonthPlanning, Default='Mois!'}"/>

</telerik:RadScheduleView.ViewDefinitions>

<telerik:RadScheduleView.GroupDescriptionsSource>

     <telerik:GroupDescriptionCollection>

         <telerik:DateGroupDescription />

         <telerik:ResourceGroupDescription ResourceType="Technicians" />

     </telerik:GroupDescriptionCollection>

</telerik:RadScheduleView.GroupDescriptionsSource>

I would like to group data by "date" and"Technicians" only in the day view definition.
In the week view definition, I would like to group by "Date" only.
Is it possible?

Kind regards,
Sebastien

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 29 Nov 2013, 04:09 PM
Hello Sebastien,

The explained scenario can be achieved by handling the VisibleRangeChanged event of the ScheduleView. Inside of the handler you can check which is the current ActiveViewDefinition and change the GroupDescriptionSource of the ScheduleView. Check the following code snippet of the VisibleRangeChanged event handler:

private void ScheduleView_VisibleRangeChanged(object sender, EventArgs e)
{
    var scheduleView = sender as RadScheduleView;
    if (scheduleView.ActiveViewDefinition is WeekViewDefinition)
    {
        this.ScheduleView.GroupDescriptionsSource = new GroupDescriptionCollection
        {
            new DateGroupDescription()
        };
    }
    else if (scheduleView.ActiveViewDefinition is DayViewDefinition)
    {
        this.ScheduleView.GroupDescriptionsSource = new GroupDescriptionCollection
        {
            new DateGroupDescription(),
            new ResourceGroupDescription { ResourceType = "Technicians" }
        };
    }
}

Hope this will work for you.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ScheduleView
Asked by
Sebastien
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or