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

Expand/Collapse All Groups?

1 Answer 663 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Random
Top achievements
Rank 2
Random asked on 28 Sep 2011, 08:23 AM
We're using a Grid with fixed Grouping (so the GroupPanel is not accessible) and want to enable expand and collapse all via buttons outside the grid. Is this possible?

I've looked through all the examples I could find, and couldn't find anything that will allow me to do it.

On the Client Settings, we've got both AllowExpandCollapse and AllowGroupExpandCollapse set to true. HierarchyLoadMode is ServerBind. We can do the expand/collapse either on the client or server side, we don't mind which.

ASPX code for the grid is as follows:
<telerik:RadGrid ID="grdMyProcesses" runat="server" AllowPaging="False"
    AutoGenerateColumns="False" AllowCustomPaging="False" BackColor="White"
    Height="600px">
    <GroupingSettings ExpandTooltip="Expand" CollapseTooltip="Collapse"  />
    <ClientSettings AllowExpandCollapse="True" AllowGroupExpandCollapse="True" >
        <Selecting AllowRowSelect="True" />
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
    <MasterTableView DataKeyNames="ProcessID" NoDetailRecordsText="No Processes."
        NoMasterRecordsText="No Processes." ShowHeadersWhenNoRecords="False" AllowCustomPaging="False"
        HierarchyLoadMode="ServerBind" BackColor="White">
        <ExpandCollapseColumn Resizable="False" >
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="ID" UniqueName="colID" Visible="False" />
            <telerik:GridTemplateColumn HeaderText="Process" SortExpression="ProcessName" ItemStyle-Width="459px" HeaderStyle-Width="459px">
                <ItemTemplate>
                    <asp:HyperLink ID="lnkProcessName" runat="server" NavigateUrl='<%# Eval("ProcessSummaryURL") %>' Text='<%# Eval("ProcessName") %>' ToolTip='<%# Eval("ProcessDefinition") %>'></asp:HyperLink>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Process Owner" SortExpression="ProcessOwnerName" ItemStyle-Width="100px" HeaderStyle-Width="100px">
                <ItemTemplate>
                    <asp:HyperLink ID="lnkProcessOwner" runat="server" NavigateUrl='<%# Eval("EmailToProcessOwnerURL") %>' Text='<%# Eval("ProcessOwnerName") %>' ToolTip="Send a message to the Process Owner about this Process."></asp:HyperLink>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <SortExpressions>
            <telerik:GridSortExpression FieldName="ProcessDisplayOrder" />
        </SortExpressions>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                  <telerik:GridGroupByField HeaderText="Group" FieldAlias="Group" FieldName="GroupName" FormatString="" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldAlias="GroupID" FieldName="GroupID" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField HeaderText="Enterprise Process" FieldAlias="EP" FieldName="EnterpriseProcessName" FormatString="" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldAlias="EnterpriseProcessDisplayOrder" FieldName="EnterpriseProcessDisplayOrder" />
                    <telerik:GridGroupByField FieldAlias="EnterpriseProcessID" FieldName="EnterpriseProcessID" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
    </MasterTableView>
</telerik:RadGrid>

Anyone know?

Enjoy
Random

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 28 Sep 2011, 09:26 AM
Hello Random,

You could set HierarchyDefaultExpanded to "true" or to "false" for the grid during the post-back, based on which button was clicked. This will result in expanding or collapsing all items.

Regards,
Vasil
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
Tags
Grid
Asked by
Random
Top achievements
Rank 2
Answers by
Vasil
Telerik team
Share this question
or