Timeline view hide empty resource groups

5 posts, 2 answers
  1. Vlad
    Vlad avatar
    19 posts
    Member since:
    Aug 2012

    Posted 23 Jan 2012 Link to this post

    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
  2. Answer
    Plamen
    Admin
    Plamen avatar
    3076 posts

    Posted 25 Jan 2012 Link to this post

    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
  3. Vlad
    Vlad avatar
    19 posts
    Member since:
    Aug 2012

    Posted 26 Jan 2012 Link to this post

    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.
  4. Answer
    Plamen
    Admin
    Plamen avatar
    3076 posts

    Posted 31 Jan 2012 Link to this post

    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
  5. Vlad
    Vlad avatar
    19 posts
    Member since:
    Aug 2012

    Posted 01 Feb 2012 Link to this post

    Hi, Plamen.

    That did the trick. Thank you.
Back to Top