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 ";}