Working with row selection in Infragistics WebHierarchicalDataGrid can be complicated since it maintains independent row selection collection for each row island and basic operations (select/unselect) aren’t that obvious. I put together a few functions to make it a little bit easier.
This first function is very basic, it returns total count of selected rows across all expanded row islands, no matter what depth. The key here is get_selectedRowsResolved() method of Selection behavior which returns an array of all selected rows:
// Returns number of selected rows from all rowislands in WebHiearchicalDataGrid // i_oGrid: Infragistics WebHiearchicalDataGrid object function selRowsCount(i_oGrid) { return i_oGrid.get_gridView().get_behaviors().get_selection().get_selectedRowsResolved().length }
The following function loops thru all selected rows, collecting values from specific column (useful for example for collecting IDs of selected rows). It accepts 3 parameters – WebHiearchicalDataGrid object, column key and separator character and returns a string in which selected values are separated by that character (if nothing is passed – default separator is comma). Continue reading →