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

Multiple Grouping - Collapse on last group

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 26 Jan 2017, 09:50 PM

I am using VS 2013 and have the most current Telerik ASP.NET AJAX components loaded.

I have a single view I am accessing and I want to have three groups: Year > Month > Ingredient

I want all child columns under the Ingredient group to be collapsed by default.  I have tried to use the GroupsDefaultExpanded but it seems to collapse everything to the first group (Year).

ASPX code below:

<telerik:RadGrid ID="FutureViewGrid" OnColumnCreated="FutureViewGrid_ColumnCreated" ShowHeader="true" runat="server" SelectMethod="GetFuturesView" ItemType="RawPricing.DataModel.RawPricingFuturesView" AllowFilteringByColumn="True" AllowSorting="True" ShowGroupPanel="True">
                 
                                <ClientSettings Resizing-AllowColumnResize="true" Resizing-ResizeGridOnColumnResize="true" AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True" Resizing-AllowResizeToFit="true">
                                    <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                                </ClientSettings>
 
                <MasterTableView SelectMethod="GetFuturesView" GroupsDefaultExpanded="false" GroupLoadMode="Server" RetainExpandStateOnRebind="true" EnableGroupsExpandAll="true" >
 
                    <GroupByExpressions>
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldName="Year"  FieldAlias="Year"/>
                                <telerik:GridGroupByField FieldName="Cost_Change" FieldAlias="CostChange" Aggregate="Sum" FormatString="{0:c}" />
                                <telerik:GridGroupByField FieldName="Amount" FieldAlias="AmountLBS" Aggregate="Sum" FormatString="{0:#,##}" />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="Year" SortOrder="Ascending" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                         <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldName="Year"  FieldAlias="Year"/>
                                <telerik:GridGroupByField FieldName="Month" FieldAlias="Month" />
                                <telerik:GridGroupByField FieldName="Cost_Change" FieldAlias="CostChange" Aggregate="Sum" FormatString="{0:c}" />
                                <telerik:GridGroupByField FieldName="Amount" FieldAlias="AmountLBS" Aggregate="Sum" FormatString="{0:#,##}" />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="Month" SortOrder="Ascending" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldName="Year"  FieldAlias="Year"/>
                                <telerik:GridGroupByField FieldName="Month" FieldAlias="Month" />
                                <telerik:GridGroupByField FieldName="Ingredient" FieldAlias="Ingredient" />
                                <telerik:GridGroupByField FieldName="Cost_Change" FieldAlias="CostChange" Aggregate="Sum" FormatString="{0:c}" />
                                <telerik:GridGroupByField FieldName="Amount" FieldAlias="AmountLBS" Aggregate="Sum" FormatString="{0:#,##}" />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="Ingredient" SortOrder="Ascending" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
                </MasterTableView>
            </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 31 Jan 2017, 04:12 PM
Hello Joshua,

I have tested the following configuration locally and there are no problems with the default group expand functionality:
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" PageSize="20"
         AllowSorting="True" AllowMultiRowSelection="True" AllowPaging="True" ShowGroupPanel="True"
         AutoGenerateColumns="False" GridLines="none">
         <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
         <MasterTableView Width="100%" GroupsDefaultExpanded="false" EnableGroupsExpandAll="true">
             <GroupByExpressions>
                 <telerik:GridGroupByExpression>
                     <SelectFields>
                         <telerik:GridGroupByField FieldAlias="Received" FieldName="Received" FormatString="{0:D}"
                             HeaderValueSeparator=" from date: "></telerik:GridGroupByField>
                     </SelectFields>
                     <GroupByFields>
                         <telerik:GridGroupByField FieldName="Received" SortOrder="Descending"></telerik:GridGroupByField>
                     </GroupByFields>
                 </telerik:GridGroupByExpression>
                 <telerik:GridGroupByExpression>
                     <SelectFields>
                         <telerik:GridGroupByField FieldAlias="FolderName" FieldName="FolderName"></telerik:GridGroupByField>
                     </SelectFields>
                     <GroupByFields>
                         <telerik:GridGroupByField FieldName="FolderName"></telerik:GridGroupByField>
                     </GroupByFields>
                 </telerik:GridGroupByExpression>
             </GroupByExpressions>
             <Columns>
                 <telerik:GridBoundColumn SortExpression="Received" HeaderText="Received" HeaderButtonType="TextButton"
                     DataField="Received" DataFormatString="{0:d}">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn SortExpression="From" HeaderText="From" HeaderButtonType="TextButton"
                     DataField="From">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn SortExpression="FolderName" HeaderText="Folder name" HeaderButtonType="TextButton"
                     DataField="FolderName">
                 </telerik:GridBoundColumn>
                 <telerik:GridBoundColumn SortExpression="Size" HeaderText="Size" HeaderButtonType="TextButton"
                     DataField="Size">
                 </telerik:GridBoundColumn>
             </Columns>
         </MasterTableView>
         <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
             <Selecting AllowRowSelect="True"></Selecting>
             <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True"
                 ResizeGridOnColumnResize="False"></Resizing>
         </ClientSettings>
         <GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
     </telerik:RadGrid>
 <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
     ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Mails" runat="server"></asp:SqlDataSource>

I have to say that from the provided screenshot and the description it is not clear what the actual problem is, so if the problem persists, please provide additional information on the exact issue.


Regards,
Konstantin Dikov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Joshua
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or