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

Expand original group from return of radwindow

2 Answers 15 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 01 Nov 2016, 02:10 PM

I have a radgrid which is set to "GroupsDefaultExpanded=False" in the MasterTableView.   When a user expands one of the groups they can edit a row within that group which opens a radwindow so they can make changes.  Once they close the RadWindow and it returns to the original page, all of the groups are back to being collapsed, but the user wants the original group they were working on to remain expanded.  I am using vb.net and aspx pages.  How can I expand the original group when returning from the RadWindow?

RadWindow Code:

<script type="text/javascript">
    function RefreshData(oWnd, eventArgs) {
        <%=Page.ClientScript.GetPostBackEventReference(btnRefresh, "")%>
    }
</script>
<telerik:RadWindow ID="rwEditAttendance" Behaviors="Close" VisibleStatusbar="false" AutoSize="true" EnableViewState="false" runat="server" Modal="true" VisibleOnPageLoad="false" OnClientClose="RefreshData" />
<asp:Button runat="Server" ID="btnRefresh" style="display:none; width:0px; height:0px;" />

 

Table code:

<telerik:RadGrid ID="rgAttendanceManager" runat="server" AllowFilteringByColumn="False" AllowSorting="True" ShowGroupPanel="False" AutoGenerateColumns="False" BorderColor="Silver">
    <MasterTableView
        GridLines="None" Width="100%"
        NoDetailRecordsText="No data matching criteria specified"
        NoMasterRecordsText="No data matching criteria specified"
        EnableNoRecordsTemplate="true"
        DataKeyNames="EmployeeId,EventDate,TimecardCommentId,TCUniqueId,Modified"
        ShowGroupFooter="true" 
        GroupsDefaultExpanded="false"
        >
        <GroupByExpressions >
            <telerik:GridGroupByExpression >
                <SelectFields >
                    <telerik:GridGroupByField FieldName="EmployeeName" HeaderValueSeparator=""  HeaderText=" "  />
                </SelectFields>
                <GroupByFields >
                    <telerik:GridGroupByField FieldName="EmployeeName"  />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
 
        <Columns>
            <telerik:GridButtonColumn UniqueName="EditComment" Text="Edit Comment" ButtonType="LinkButton" CommandName="EditComment" />
            <telerik:GridDateTimeColumn DataField="EventDate" HeaderText ="Event Date"  SortExpression="EventDate" HeaderStyle-Wrap="false" DataFormatString="{0:d}"/>
             
            <telerik:GridDateTimeColumn DataField="HistoricalDate" HeaderText ="Historical Date"  SortExpression="HistoricalDate" HeaderStyle-Wrap="false" DataFormatString="{0:d}"/>
            <telerik:GridBoundColumn DataField="PaycodeName" HeaderText="Paycode Name" SortExpression="PaycodeName" ItemStyle-Wrap="false" />
            <telerik:GridBoundColumn DataField="CommentText" HeaderText="Comment Text" SortExpression="CommentText" ItemStyle-Wrap="false" />
            <telerik:GridNumericColumn DataField="CommentValue" HeaderText="Comment Value" HeaderStyle-Wrap="false" DataType="System.Decimal" AllowRounding="false" DecimalDigits="2" Aggregate="Sum" FooterText="Total Attendance Score: "/>
            <telerik:GridDateTimeColumn DataField="PunchIn" HeaderText ="Punch In"  SortExpression="PunchIn" HeaderStyle-Wrap="false" DataFormatString="{0:MM/dd/yyyy HH:mm}"/>
            <telerik:GridDateTimeColumn DataField="PunchOut" HeaderText ="Punch Out"  SortExpression="PunchOut" HeaderStyle-Wrap="false" DataFormatString="{0:MM/dd/yyyy HH:mm}"/>
            <telerik:GridCheckBoxColumn HeaderText="Modified" DataField="Modified" HeaderStyle-Wrap="false" />
        </Columns>
 
    </MasterTableView>
</telerik:RadGrid>

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 04 Nov 2016, 12:47 PM
Hi Patrick,

Generally, for hierarchical grid structure you can use:
<MasterTableView ... RetainExpandStateOnRebind="true">

For grouping, you can try to change the load mode to Client:
<MasterTableView ... GroupLoadMode="Client">

Alternatively, you can use a session collection variable to save the expanded groups and re-apply them after the window is closed:
http://www.telerik.com/support/code-library/persist-groups-expanded-state-on-rebind

Regards,
Eyup
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
0
Patrick
Top achievements
Rank 1
answered on 09 Nov 2016, 01:27 PM
Thank you!   This did exactly what I needed.  It keeps the last expanded group(s) expanded and the users are much happier!
Tags
Grid
Asked by
Patrick
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or