jQuery EasyUI, datagrid, treegrid formatter 參數比較 row index


 

如題:

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>';

}}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM