0

Since I use the jqGrid's GroupingGroupBy to group column(s), so how do I get a list (rows) of group column only?

Also, how do I iterate through rows inside a group column?

Also, how do I tell the spreadsheet is group columns?

Thanks.

fletchsod
  • 3,560
  • 7
  • 39
  • 65

1 Answers1

1

I am not sure which "group column(s)" you mean. You can use

var $groupRows = $("#grid").find(">tbody>tr.jqgroup");

to get the array of <tr> element of grid which represent grouping headers.

Alternatively you can get information about the groups by

var groups = $("#grid").jqGrid("getGridParam", "groupingView").groups;

and iterate over the array groups. Look at the code of the demo for an example.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Ah! "groupingView" is what you guys refer to. I got it now! Thanks. My project is to replace the displayed text (value) there with a different text. (That is to display total rows count in the groups plus display the average price of those group rows. I hope I can do it. If you can provide pointers then that would be great! – fletchsod Aug 19 '13 at 15:50
  • @fletchsod: To customize information displayed during grouping I can recommend [the answer](http://stackoverflow.com/a/10805487/315935) and [the answer](http://stackoverflow.com/a/7622718/315935). – Oleg Aug 19 '13 at 17:46
  • I see it use the colModel's formatter. I'm using loadComplete to get the job done because of the dynamic "groupingGroupBy". The spreadsheet can be either no groupingView or groupingView, either way dynamically. Oh well. – fletchsod Aug 19 '13 at 22:03