如題:
datagrid中,見官方文檔:
formatter | function | The cell formatter function, take three parameter: value: the field value. rowData: the row record data. rowIndex: the row index. |
undefined |
例子:
{field:'id',title:'id',width:100,align:'center',formatter:function(value, row, index){
return '<span style="color;red" >' + value + row.id + index + '</span>';
}}
treegrid中,繼承了這個屬性,但是有些變化,官方文檔沒有說明,總結了一下
formatter | function | The cell formatter function, take two parameter: value: the field value.//這個照舊 rowData: the row record data.//貌似還加了_parentId,status屬性(值為open|close) rowIndex: the row index.//注意,這個末有了! |
undefined |
檢驗代碼:
{field:'id',title:'id',width:100,align:'center',formatter:function(value, row, index){
var xs = [];for (var p in row) {xs.push(p + ":=" + row[p]);}alert(xs.join('\n')); return '<span style="color;red" >' + value + row.id + index + '</span>';
}}