Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
ExpandAll rows in Grouped Columns Grid
posted

Hellow, 

I have my whdGrid with grouped columns on the initial load, 

whdgExpenseAproveView.GroupingSettings.EnableColumnGrouping = Infragistics.Web.UI.DefaultableBoolean.True
whdgExpenseAproveView.GroupingSettings.GroupedColumns.Clear()
whdgExpenseAproveView.GroupingSettings.GroupedColumns.Add("ApStatus")

then, I have two buttons above the grid, Expand All and Collapse All, what I want is just expand all groups or collapse the entire grid, no matter if client o server side, 

I tried everything but nothing works.:

Protected Sub btnExpand_Click(sender As Object, e As EventArgs) Handles btnExpand.Click
whdgExpenseAproveView.GroupingSettings.InitialRowExpandState = ExpandState.Expand
whdgExpenseAproveView.DataBind()
End Sub

it doesnt work

function ExpandAllRowsNew(Webgrid) {
var grid = $find(Webgrid);
var rows = grid.get_gridView().get_rows()
var oRow
for (i = 0; i < rows.get_length() ; i++) {
oRow = rows.get_row(i);
oRow.set_expanded(true);
}

nothing, 

how can I get this accomplish. 

My grid is just a flat grid with some columns:

<Columns>
<ig:BoundDataField DataFieldName="UserName" Key="UserName" Width="10%" />
<ig:BoundDataField DataFieldName="ApproverName" Key="ApproverName" Width="10%" />
<ig:BoundDataField DataFieldName="LocationDesc" Key="LocationDesc" hidden="true" />
<ig:BoundDataField DataFieldName="GradeDesc" Key="GradeDesc" hidden="true" />
<ig:BoundDataField DataFieldName="ApStatus" Key="ApStatus" hidden="true" />
</Columns>


thanks

  • 11095
    Verified Answer
    Offline posted

    Hello,

    Thank you for contacting Infragistics!

    When you call get_rows() you are getting the rows of grid but no grouped rows. In order to get the grouped rows you call get_groupRows(), after that you can get row by index and set_expand(true).

    Let me know if you need further assistance.