Home › Forums › Guriddo jqGrid JS › Grouping Data questions
This topic contains 5 replies, has 3 voices, and was last updated by tony 3 months, 1 week ago.
Hello,
We are using v5.3.0 and using grouping with subgrid and celledit, grouping works great but having some trouble with summary
2. How do change the style of the grouping row? background color?
Hello,
About 1. Can you please post the grid setup and some simple data or send a demo link or demo files to the support?
About 2. It depend how you want to process.
a) In case if you want to add the same color of all first level grouping you can:
1 2 3 4 5 6 |
<style> .jqGridghead_0 td { background-color: background; } </style> |
where jqGrid word in the classname is the id of the grid.
for the second level the generated class is jqGridghead_1 and etc.
b) If you want to do this dynamically depending a value one possible solution is to get the grouping names and add the appropriate classes in loadComplete by example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
loadComplete: function () { var i, group, myClass, Pref = this.id + "ghead_", groups = $(this).jqGrid("getGridParam", "groupingView").groups, l = groups.length; for (i = 0; i < l; i++) { group = groups<em class="d4pbbc-italic"></em>; switch (group.value) { case "ALFKI": myClass = "class1"; break; case "ANATR": myClass = "class2"; break; default: myClass = ""; break; } if (cssClass !== "") { $("#" + Pref + group.idx + "_" + i).addClass(cssClass); } } } |
and then define a style like:
1 2 3 4 5 6 7 8 9 |
<style> .class1 td { background-color: background; } .class2 td { background-color: green; } </style> |
Kind Regards,
Will
Guriddo Support Team
Thank you for solution regarding background color.
Here’ s a link
http://50.53.70.243:90/jqgrid/gridGroupingData.php
you will see in code that columns – dblOrdered and curSalePrice – have cellattr function – if I remove the cellattr – then grouping summary renders correctly.
I believe the problem is rdata parameter is undefined for the grouping rows – this is what might be causing the issue.
Thanks,
Kris
Hello,
cellattr should not be a problem. We have prepared similar example and it works. See here
The problem is maybe in another part of the code. Try to use no grouping, but with cellattr function.
Kind Regards,
Will
Guriddo Support Team
Hello Will,
The code works fine when grouping is set to false
yes, I understand cellattr is not a problem, I believe the problem – is with rdata parameter. When cellattr is being processed for every row – grouping header/row does not have rdata object.
I had to specifically add a check and now it works.
1 2 3 4 5 6 7 |
,cellattr : function(rowId, cellValue, rawObject, cm, rdata) { if(rdata !== 'undefined' && Array.isArray(rdata)){ if(rdata.ysnSub == '1'){ return " class='eg-ct-badge-blue'"; } } } |
Thanks,
kris
Guroddo customer
Hello Kris,
Thank you for posting your solution and let us know where the problem was.
Kind Regards,
Tony
Tony Tomov
You must be logged in to reply to this topic.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top