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
20
Get count of Grouped Rows when/after a filter is applied
posted

How can I get the count of grouped rows when a filter is being applied in the XAMGrid? I am getting the count of filtered records with xamGrid.RecordManager.GetFilteredInDataRecords().Count() , now I just need to know how many groups there are.  I am able to get the number of groups with xamGrid.RecordManager.Groups.Count but once I filter the data and the number of rows is reduced, this property still shows the total groups as if there was not a filter. 

Parents
  • 6759
    Verified Answer
    Offline posted

    Hi Jacob,

    I assume that you're using XamDataGrid and not XamGrid - these are two different grid controls. In order to get only the groups that are left after the grid is filtered you could do something like this:

    filteredInGroups = grid.RecordManager.GetFilteredInDataRecords().Select(r => r.TopLevelGroup).Distinct().Count();

    This will give only the top level groups if the XamDataGrid is grouped by few columns.

    You could check out the attached sample solution illustrating the approach above.

    Hope this helps,

    XamDataGrid_GroupsCountWhenFiltered.zip
Reply Children
No Data