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

Timeline view hide empty resource groups

4 Answers 163 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Vlad
Top achievements
Rank 1
Vlad asked on 23 Jan 2012, 04:21 PM
Hi,

I have searched the web, but apparently do not posses enough skills to find desired information.

My question: Is it possible to tell Timeline view to hide resources declared in GroupBy field of TimelineView setting, if they do not contain any appointments in selected period? I have seen that Silverlight and WPF do contain such functionality with DisplayEmptyGroup property, but have not seen an option to do that in ASP.NET AJAX.

Here is my Scheduler markup.
<telerik:RadScheduler ID="schTimeline" runat="server" SelectedView="TimelineView" AllowDelete="false" AllowEdit="false" AllowInsert="false" DataSourceID="odsTimelineData"
    DataKeyField="ID" DataSubjectField="SUBJECT" DataStartField="START_DATE" DataEndField="END_DATE" OverflowBehavior="Expand" RowHeaderWidth="180px">
    <TimelineView UserSelectable="false" GroupBy="Employees" GroupingDirection="Vertical" SortingMode="Global" />
    <MultiDayView UserSelectable="false" />
    <DayView UserSelectable="false" />
    <WeekView UserSelectable="false" />
    <MonthView UserSelectable="false" />
    <ResourceTypes>
        <telerik:ResourceType KeyField="Username" Name="Employees" TextField="Name" ForeignKeyField="PERSON" DataSourceID="odsEmployees"/>
    </ResourceTypes>
    <AppointmentTemplate>
        <div class="<%# Eval("CssClass") %>">
            <p class="rsCustomSubject"><%# Eval("Subject") %></p>
        </div>
    </AppointmentTemplate>
</telerik:RadScheduler>

What I would like to do is hide all employees that don't have any appointments in timespan displayed in timeline view.

Thank you for your response

4 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 25 Jan 2012, 05:50 PM
Hi Vladimir, 

There is no such property in RadScheduler for ASP.NET AJAX but it can be implemented by using the idea form the Resource Paging Code Library.

I am attaching a sample project that should work for you.

Hope this will be helpful.

Kind regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Vlad
Top achievements
Rank 1
answered on 26 Jan 2012, 12:38 PM
Hi Plamen,

This worked like a charm. Thank you.

Unfortuantely for you, I now have a bonus question :). Is it possible to create an EmptyMessage when all resources are removed from timeline? I tried faking one, with a procedure to add a resource, if all were removed in DataBound event handler:

If (schTimeline.Resources.GetResourcesByType("Employees").Count = 0) Then
    Call schTimeline.Resources.GetResourcesByType("Employees").Add(New Resource("Employees", "NiZadetkov", "Ni zadetkov"))
End If

However, it didn't display at all.
0
Accepted
Plamen
Telerik team
answered on 31 Jan 2012, 09:14 AM
Hi Vladimir,

 
You can use the yellow code bellow to add a dummy resource when all other resources are removed:

if (counter==0)
           {
                
                   RadScheduler1.Resources.Remove(resource);
                   if (RadScheduler1.Resources.GetResourcesByType("User").Count == 0)
                   {
                       RadScheduler1.Resources.Add(new Resource("User", 4, "Empty"));
                   }
                   remainingResources.Add(resource);
             
           }

Hope this will help.

Regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Vlad
Top achievements
Rank 1
answered on 01 Feb 2012, 06:29 PM
Hi, Plamen.

That did the trick. Thank you.
Tags
Scheduler
Asked by
Vlad
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Vlad
Top achievements
Rank 1
Share this question
or