Formatter in easyui DataGrid does not work

Source: Internet
Author: User

Today, easyui DataGrid is used as the list. Some data needs to be formatted. When the status of a field is inferred, it is found that formatter formatting does not work for the corresponding function.


<Table id = "list_data" Title = "unaudited report" class = "easyui-DataGrid" style = "width: auto; Height: 350px; "url =" "toolbar =" # toolbar "pagination =" true "pagesize =" 10 "Total =" 20 "rownumbers =" true "fitcolumns =" true "singleselect =" true ""pagelist =" [] "loadmsg =" loading data, please wait... "> <thead> <tr> <TH data-Options =" field: 'report name', width: 200, align: 'center' "> report name </Th> <TH data-Options =" field: 'report group', width: 80, align: 'center' "> report group </Th> <TH data-Options =" field: 'report type', width: 80, align: 'center' "> report type </Th> <TH data-Options =" field: 'report category', width: 80, align: 'center' "> report Category </Th> <TH data-Options =" field: 'tabulation person ', width: 80, align: 'center' "> reported by </Th> <TH data-Options =" field: 'actual output date', width: 90, align: 'center' "formatter =" changedateformat "> reporting time </Th> <TH data-Options =" field: 'reporting unit ', width: 80, align: 'center' "> Reporting Unit </Th> <TH data-Options =" field: 'audit status', width: 80, align: 'center' "> Audit status </Th> <TH data-Options =" field: 'audit status', width: 80, align: 'center' "formatter =" managerstr "> operation </Th> </tr> </thead> </table>


The question is:

<TH data-Options = "field: 'audit status', width: 80, align: 'center'" formatter = "managerstr"> operation </Th>

Changed to a field that has not been used before. Otherwise, it will not be formatted.

<TH data-Options = "field: 'user report number', width: 80, align: 'center'" formatter = "managerstr"> operation </Th>


Later, I checked and found that, if the field value of a column has already appeared before, then the field column will appear later. Here, my field value is "review status ", it will be used according to the field column that appears for the first time. If no formatter exists for the columns with the same field value for the first time, the formatter may be invalid.

Function managerstr (value, rowdata, rowindex) {If (rowdata ["audit status"] = "not reviewed") Return "1 "; else if (rowdata ["review status"] = "retrieved and refilled") Return "2"; else return "reviewed, disagree with the operation ";}



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.