Forum


16:08

Hi,
I would like to know if it's possible to add a class to a row during Json generation ?
Thus, I would be able to color rows thanks to css depending row values.
[Example]
$response->rows[$i]['id']=$row['id'];
$response->rows[$i]['clazz']='myCssClass';
$response->rows[$i]['cell'] = array([...]);
Thanks.
21:13

Moderators
30/10/2007

Hello,
Not possible for now. When using the readers with repeatitems set to false, this can be done easy, but will make a lot of code when this option is set to true.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
12:09

Hi,
I just want to say that I manage to do what I want by editing your JavaScript.
In grid.base.js :
Line 611 : (for Json)
- rowData[ari++] = "<tr id=\\""+ idr +"\\" role=\\"row\\" class= \\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\\">";
+ rowData[ari++] = "<tr id=\\""+ idr +"\\" role=\\"row\\" class= \\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+" " +cur["clazz"]+"\\">";
======================================
I haven't tried what is below, because I do not use Xml format.
Line 475-->484 : (for Xml)
if( (idn+"").indexOf("[") === -1 ) {
if (f.length) {
getId = function( trow, k) {return $(idn,trow).text() || k;
getClazz = function( trow, k) {return $("clazz",trow).text() || k;};
} else {
getId = function( trow, k) {return $(ts.p.xmlReader.cell,trow).eq(idn).text() || k;
getClazz = function( trow, k) {return $(ts.p.xmlReader.cell,trow).eq("clazz").text() || k;};
}
}
else {
getId = function( trow, k) {return trow.getAttribute(idn.replace(/[\\[\\]]/g,"")) || k;
getClazz = function( trow, k) {return trow.getAttribute("clazz".replace(/[\\[\\]]/g,"")) || k;};
}
Line 496-->498 :
rid = getId(xmlr,br+j);
rclazz = getClazz(xmlr,br+j);
cn1 = j%2 == 1 ? cn : '';
rowData[ari++] = "<tr id=\\""+rid+"\\" role=\\"row\\" class =\\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+" "+rclazz +"\\">";
13:52

Moderators
30/10/2007

Hello,
Thanks. Will try to investigate this and if everthing is ok will implement it - but remember I do not promiese this.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
50 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66