TIWCGJQGridOptions.RowAttrFn Property
Allow change the row html attributes (style, classes or tabindex), just like RowAttr, but with possibility to check the cell value.
The grid passes the following parameters to javascript function:
Parameter | Description |
---|---|
ts | JSon object composed of all columns with respective values: Example: { ID = "1" , Name = "Description 1", Type = 2 } template: { <colModel name> : <column value> } |
td | JSon object composed of all columns with respective values. |
curr | Current index |
id | Id of row |
published property RowAttrFn: TIWCGJSonFunc index 136 read GetFuncValue write SetFuncValue stored IsFuncStored;
In the example below, we will check the value of the column "Kind", and based on the value change the text color.
JScript:= TIWCGJScript.Create; try with JScript do begin Add('function(ts, td, curr, id){'); Add(' if (ts.Kind == "0") {'); Add(' return { "style" : "color: red"}'); Add(' } else {'); Add(' return { "style" : "color: green"}'); Add(' }'); Add('}') end; Result.JQGridOptions.RowAttrFn.Script:= JScript.Text; finally JScript.Free; end;