JQuery Easyui, DataGrid, Treegrid formatter parameter comparison row index

Source: Internet
Author: User

 

Title:

In the DataGrid, see official Documentation:

Formatter function The cell formatter function, take three parameter:
value:the field value.
Rowdata:the row record data.
Rowindex:the row index.
Undefined

Example:

{field: ' id ', title: ' ID ', width:100,align: ' Center ', formatter:function (value, row, index) {
Return ' <span style= ' color;red > ' + value + row.id + index + ' </span> ';
}}

Treegrid, inherited this attribute, but some changes, the official document did not explain, summed up a bit

Formatter function The cell formatter function, take the parameter:
value:the field value.//the same as usual.
Rowdata:the row record data.//seems to have added _parentid,status attribute (value is open|close)
Rowindex:the row index.//Notice, this end has!
Undefined

Inspection code:

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

}}

JQuery Easyui, DataGrid, Treegrid formatter parameter comparison row index

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.