I decided to change the datatype from xml to json, as I want to see the processing time since json is native to javascript and may have a bit benefit on the performance; another reason is I found the 'rowobject' argument in formatter is quite useful and easy to get the value of the row data rather than in xml datatype.
example:
colModel:[
{name:'account', index:'account', width:100} ,
{name:'credit', index:'credit', hidden:true} ,
{name:'name', index:'name', width:50, 
                formatter: function(cellvalue, options, rowObject) {
                    var color = (rowObject[1]<=650 || rowObject['credit']<=650) ? 'red':'black';  //when the grid first load, it used integer as the index of the array, after loadComplete, the grid will use the column name as the index.
                    return '<span style="color:'+color+';">' + cellvalue + '</span>';
                }
}, ...]
 
1 comment:
This is what the solution I was expecting. Thank you so much for clear explanation.
Post a Comment