新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
layui對table中的數(shù)據(jù)進行轉(zhuǎn)義的實例
方法一通過done回調(diào)進行遍歷:
創(chuàng)新互聯(lián)公司長期為1000多家客戶提供的網(wǎng)站建設(shè)服務,團隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務;打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為東源企業(yè)提供專業(yè)的成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè),東源網(wǎng)站改版等技術(shù)服務。擁有十余年豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。
//方法級渲染 table.render({ id: 'demoList', elem: '#demoList' , url: 'showDemoList' , cols: [[ {checkbox: true, fixed: true, width: '10%'} , {field: 'id', title: '編號', width: '15%', sort: true} , {field: 'pipe_id', title: '機構(gòu)ID', width: '15%'} , {field: 'bank_id', title: '銀行ID', width: '10%'} , {field: 'pipe_cost', title: '成本', width: '10%'} , {field: 'status', title: '狀態(tài)', width: '20%'} , {field: 'remark', title: '操作', width: '20%', toolbar: '#toolBar'} ]], done: function (res, curr, count) { //如果是異步請求數(shù)據(jù)方式,res即為你接口返回的信息。 //如果是直接賦值的方式,res即為:{data: [], count: 99} data為當前頁數(shù)據(jù)、count為數(shù)據(jù)總長度 $("[data-field='status']").children().each(function () { if ($(this).text() == '0') { $(this).text('有效'); } else if ($(this).text() == '1') { $(this).text('無效'); } }); } , page: true , height: 'full-83' });
方法二通過layui的templet模板實現(xiàn):
, {field: 'status', title: '狀態(tài)', width: '20%',templet:'#status'}
以上這篇layui 對table中的數(shù)據(jù)進行轉(zhuǎn)義的實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持創(chuàng)新互聯(lián)。
文章名稱:layui對table中的數(shù)據(jù)進行轉(zhuǎn)義的實例
文章網(wǎng)址:http://www.ef60e0e.cn/article/pjjdeo.html