layui中對table中的數據進行判斷(0、1)轉換為提示信息


layui table 時間格式轉換、根據數據轉換為提示信息

    <script type="text/javascript">
         layui.use("table", function (table) {
         //展示已知數據
         t = table.render({
            cols: [[ //標題欄
                { field: 'NOA_NPCode', title: '產品', align: 'center', sort: true },
                { field: 'NOA_Count', title: '剩余次數', align: 'center', sort: true },
                { field: 'NOA_ExpireTime', title: '到期時間', align: 'center', sort: true, templet: '<div>{{ layui.util.toDateString(d.NOA_ExpireTime, "yyyy年MM月dd日") }}</div>'},
                { field: 'operate', title: '操作',width: 150, toolbar: '#barTable', align: 'center' }
            ]],
            elem:'#idforRenderElem',
            url: '@Url.Action("GetAccountList")',
            page: false,
            response: {
                statusName: 'Code',
                statusCode: 1,
                dataName: 'Data'
             },
             done: function (res, curr, count) {
                 $("[data-field='NOA_Count']").children().each(function () {
                     if ($(this).text() == '-1') {
                         $(this).text("不限次")
                     } 
                 });
             }
        });
        //監聽工具條
        table.on('tool(layFilterTable)', function (obj) {
            if (obj.event === 'edit') {
                //頁面層
                AddOrEdit(obj);
            }
        });
        });

        //點擊刷新按鈕
        $('#btnRefresh').click(function () {
            t.reload();
        });
    </script>

 


免責聲明!

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



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