亚洲精品久久久久久第一页-人妻少妇精彩视品一区二区三区-91国产自拍免费视频-免费一级a在线播放视频正片-少妇天天日天天射天天爽-国产大屁股喷水视频在线观看-操美女骚穴抽插性爱视频-亚洲 欧美 中文字幕 丝袜-成人免费无码片在线观看

bootstrap設(shè)計(jì)的精美網(wǎng)站推薦 bootstrap源碼使用


bootstrap設(shè)計(jì)的精美網(wǎng)站推薦 bootstrap源碼使用

文章插圖
今天要做一個(gè)報(bào)表導(dǎo)入并預(yù)覽的功能,使用layui的文件上傳,獲取表格數(shù)據(jù),接著把表格數(shù)據(jù)返回前臺(tái),使用bootstraptable展示,實(shí)現(xiàn)一個(gè)預(yù)覽表格數(shù)據(jù)的效果 。通過后臺(tái)處理后的數(shù)據(jù)bootstraptable加載數(shù)據(jù),其實(shí)具體實(shí)現(xiàn)不難,今天要講的是在實(shí)現(xiàn)數(shù)據(jù)加載之后,我們出現(xiàn)了一些問題,我會(huì)附源碼講解問題的解決方案分享給大家
通過后臺(tái)處理后的數(shù)據(jù)// 數(shù)據(jù)經(jīng)過處理后,真實(shí)數(shù)據(jù)已做修改Data = https://www.520longzhigu.com/diannao/[{JJSRBY: 6666,JJSRBYLJ: 155666,JJZCBY: 777,JJZCBYLJ: 2266633,LJJY: 151515,NCYE: 121212,SZYEBY: 11111,SZYEBYLJ: -11559,XZ:"企業(yè)職工基本養(yǎng)老保險(xiǎn)",ZFNL: 22.1},{JJSRBY: 6666,JJSRBYLJ: 155666,JJZCBY: 777,JJZCBYLJ: 2266633,LJJY: 151515,NCYE: 121212,SZYEBY: 11111,SZYEBYLJ: -11559,XZ: "工傷保險(xiǎn)",ZFNL: 22.1},...];bootstraptable加載數(shù)據(jù)// field 需要和 Data中每個(gè)對(duì)象中的字段名對(duì)應(yīng) 。// $('#previewTable').bootstrapTable({data : Data,//toolbar: '#toolBar',striped: true, //是否顯示行間隔色cache: false, //是否使用緩存,默認(rèn)為true,//minimumCountColumns: 2, //最少允許的列數(shù)clickToSelect: true, //是否啟用點(diǎn)擊選中行columns: [[{field : 'XZ', title: '險(xiǎn)種', rowspan:2, align:"center"},{field : 'NCYE', title: '年初余額', rowspan:2,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.NCYE;return num.toFixed(2);}},{title: '基金收入', colspan:2,align:"center"},{title: '基金支出', colspan:2,align:"center"},{title: '當(dāng)年收支結(jié)余', colspan:2,align:"center"},{field : 'LJJY',title:'累計(jì)結(jié)余', rowspan:2,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.LJJY;return num.toFixed(2);}},{field : 'ZFNL',title: '支付能力(月)', rowspan:2,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.ZFNL;return num.toFixed(1);}},],[{field : 'JJSRBY',title:'本月', colspan:1,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.JJSRBY;return num.toFixed(2);}},{field : 'JJSRBYLJ',title:'本月止累計(jì)', colspan:1,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.JJSRBYLJ;return num.toFixed(2);}},{field : 'JJZCBY',title:'本月', colspan:1,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.JJZCBY;return num.toFixed(2);}},{field : 'JJZCBYLJ',title:'本月止累計(jì)', colspan:1,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.JJZCBYLJ;return num.toFixed(2);}},{field : 'SZYEBY',title:'本月', colspan:1,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.SZYEBY;return num.toFixed(2);}},{field : 'SZYEBYLJ',title:'本月止累計(jì)', colspan:1,halign:"center",align:"right",formatter: function(value, row, index) {let num = row.SZYEBYLJ;return num.toFixed(2);}}]],formatNoMatches : function() {return '<div style="color: #b8b8b8; height: 15px;"> 暫無數(shù)據(jù) </div>';// 如果無數(shù)據(jù)則顯示這個(gè)}});這個(gè)實(shí)現(xiàn)其實(shí)不難,但是,沒想到的是,接下來的步驟出問題了,因?yàn)槲覀冃枰獙?shí)現(xiàn)BootstrapTable重新加載,這種問題有以下兩種解決方案:
原始加載的表格
解決后加載表格
最重要的一點(diǎn),寫在最前面:BootstrapTable一個(gè)頁(yè)面只能加載一次;想要重新加載,就必須先銷毀 ,再重新初始化Bootstraptable 。銷毀的方法:
$(‘#id’).bootstrapTable(‘destroy’);
好了,接下來我們來看以以下具體實(shí)現(xiàn)方式
遇到此問題的情景在table上方添加了文本輸入框,用于查詢過濾table中的數(shù)據(jù),因此需要根據(jù)查詢條件,重新向后臺(tái)向DAO層發(fā)送請(qǐng)求,返回新的結(jié)果 。
解決辦法原始加載的表格這是一開始進(jìn)入頁(yè)面加載的表格 。


以上關(guān)于本文的內(nèi)容,僅作參考!溫馨提示:如遇健康、疾病相關(guān)的問題,請(qǐng)您及時(shí)就醫(yī)或請(qǐng)專業(yè)人士給予相關(guān)指導(dǎo)!

「愛刨根生活網(wǎng)」www.malaban59.cn小編還為您精選了以下內(nèi)容,希望對(duì)您有所幫助: