EasyUI DataGrid 中欄位 formatter 格式化不起作用

來源:互聯網
上載者:User

標籤:style   blog   使用   io   資料   for   2014   art   

今天用 EasyUI datagrid 來做列表,要對一些資料進行格式化,推斷某欄位狀態時,發現 formatter 格式化相應的函數不起作用。


<table id="list_data" title="未審核報表" class="easyui-datagrid" style="width: auto;height:350px;" url=""       toolbar="#toolbar" pagination="true" pagesize="10" total="20"       rownumbers="true" fitcolumns="true" singleselect="true" pagelist="[10,20]" loadmsg="正在努力載入資料,請稍後...">    <thead>        <tr>            <th data-options="field:‘報表名稱‘,width:200,align:‘center‘">報表名稱</th>            <th data-options="field:‘報表分組‘,width:80,align:‘center‘">報表分組</th>            <th data-options="field:‘報表類型‘,width:80,align:‘center‘">報表類型</th>            <th data-options="field:‘報表分類‘,width:80,align:‘center‘">報表分類</th>            <th data-options="field:‘製表人‘,width:80,align:‘center‘">上報人</th>            <th data-options="field:‘實際報出日期‘,width:90,align:‘center‘" formatter="ChangeDateFormat">上報時間</th>            <th data-options="field:‘填報單位‘,width:80,align:‘center‘">上報單位</th>            <th data-options="field:‘審核狀態‘,width:80,align:‘center‘">審核狀態</th>            <th data-options="field:‘審核狀態‘,width:80,align:‘center‘" formatter="managerstr">操作</th>        </tr>    </thead></table>


出問題是這句:

<th data-options="field:‘審核狀態‘,width:80,align:‘center‘" formatter="managerstr">操作</th>

改成,前面沒有出現過的欄位,否則,不會進來格式化的。

<th data-options="field:‘使用者報表編號‘,width:80,align:‘center‘" formatter="managerstr">操作</th>


後來檢查發現 : 假設某列的 field值,在前面已經出現過,則後出現的同field列,在這裡,我的是 “審核狀態”,將按第一次出現的field列使用。假設第一次出現的field同值的列沒有formatter,興許的formatter將無效。

function managerstr(value,rowData,rowIndex) {        if (rowData["審核狀態"] == "未審核")            return "1";        else if (rowData["審核狀態"] == "已取回重填")            return "2";        else            return "已經審核,不同意操作";    }



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.