如何實(shí)現(xiàn)bootstrap-table表格導(dǎo)出-創(chuàng)新互聯(lián)

這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)如何實(shí)現(xiàn)bootstrap-table表格導(dǎo)出,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

創(chuàng)新互聯(lián)一直在為企業(yè)提供服務(wù),多年的磨煉,使我們?cè)趧?chuàng)意設(shè)計(jì),網(wǎng)絡(luò)營(yíng)銷推廣到技術(shù)研發(fā)擁有了開(kāi)發(fā)經(jīng)驗(yàn)。我們擅長(zhǎng)傾聽(tīng)企業(yè)需求,挖掘用戶對(duì)產(chǎn)品需求服務(wù)價(jià)值,為企業(yè)制作有用的創(chuàng)意設(shè)計(jì)體驗(yàn)。核心團(tuán)隊(duì)擁有超過(guò)十載以上行業(yè)經(jīng)驗(yàn),涵蓋創(chuàng)意,策化,開(kāi)發(fā)等專業(yè)領(lǐng)域,公司涉及領(lǐng)域有基礎(chǔ)互聯(lián)網(wǎng)服務(wù)達(dá)州服務(wù)器托管、App定制開(kāi)發(fā)、手機(jī)移動(dòng)建站、網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)絡(luò)整合營(yíng)銷。

文檔參數(shù)說(shuō)明:

Table Export

Use Plugin: tableExport.jquery.plugin

Usage

<script src="extensions/export/bootstrap-table-export.js"></script>

Options

showExport        //是否顯示到處按鈕

  • type: Boolean

  • description: set true to show export button.

  • default: false

exportDataType   //導(dǎo)出表格方式(默認(rèn)basic:只導(dǎo)出當(dāng)前頁(yè)的表格數(shù)據(jù);all:導(dǎo)出所有數(shù)據(jù);selected:導(dǎo)出選中的數(shù)據(jù))

  • type: String

  • description: export data type, support: 'basic', 'all', 'selected'.

  • default: basic

exportTypes   //導(dǎo)出文件類型 ,支持多種類型文件導(dǎo)出

  • type: Array

  • description: export types, support types: 'json', 'xml', 'png', 'csv', 'txt', 'sql', 'doc', 'excel', 'xlsx', 'pdf'.

  • default: ['json', 'xml', 'csv', 'txt', 'sql', 'excel']

exportOptions  //導(dǎo)出的表格參數(shù)設(shè)置,這里參照tableExport.jquery.plugin插件中的參數(shù)進(jìn)行設(shè)置,點(diǎn)擊官網(wǎng)文檔中的option藍(lán)色字體就可跳轉(zhuǎn)到該插件的說(shuō)明文檔處,網(wǎng)址:https://github.com/hhurz/tableExport.jquery.plugin#options。

  • type: Object

  • description: export options of tableExport.jquery.plugin

  • default: {}

Icons     //導(dǎo)出按鈕圖標(biāo)設(shè)置

  • export: 'glyphicon-export icon-share'

下面直接貼代碼:

//查詢
    function refresh(){
        $("#datatable").bootstrapTable('refresh',{url:'__MODULE__/Statistics/listData'});
    }
    //查詢條件
    function queryParams(params){
        params['project_id'] = $("select[name=project_id]").find("option:selected").val();
        params['time_field'] = $("select[name=time_field]").find("option:selected").val();
        params['start_time'] = $("input[name=start_time]").val();
        params['end_time'] = $("input[name=end_time]").val();
        params['user_name'] = $("input[name=user_name]").val();
        params['telephone'] = $("input[name=telephone]").val();
        params['room_confirm_number'] = $("input[name=room_confirm_number]").val();
        params['lineson'] = $("select[name=lineson]").val();
        params['invoice'] = $("select[name=invoice]").val();
        return params;
    }
 
 
    function DoOnMsoNumberFormat(cell, row, col) {
        var result = "";
        if (row > 0 && col == 0)
            result = "\\@";
        return result;
    }
    var rowCount = 0;
    $("#datatable").bootstrapTable({
        height:"500",
        url: '__MODULE__/Statistics/listData',  //表格數(shù)據(jù)請(qǐng)求地址
        pagination:true,   //是否分頁(yè)
        search: false,    //是否顯示查詢框
        sortName: "id",    //排序相關(guān)
        sortOrder: "desc",
        queryParams:'queryParams',
        method:"post",
        sortable:true,
        dataType:'json',
        toolbar: "#exampleTableEventsToolbar",
        icons: {refresh: "glyphicon-repeat", toggle: "glyphicon-list-alt", columns: "glyphicon-list"},
        pageList:[10, 25, 50, 100],
        clickToSelect:true,
        exportDataType:'all',
 
        onLoadSuccess:function(data){   //表格數(shù)據(jù)加載成功事件
            rowCount = data.length-1;
            $("#datatable").bootstrapTable('hideRow', {index:rowCount});
            $("#datatable td").attr("data-tableexport-msonumberformat","\@");
            $("#datatable tr").attr("data-tableexport-display","always");
        },
        onPageChange:function(number,size){  //表格翻頁(yè)事件
            $("#datatable").bootstrapTable('hideRow', {index:rowCount});
            $("#datatable td").attr("data-tableexport-msonumberformat","\@");
            $("#datatable tr").attr("data-tableexport-display","always");
 
        },
        showExport: true,  //是否顯示導(dǎo)出按鈕
        buttonsAlign:"right",  //按鈕位置
        exportTypes:['excel'],  //導(dǎo)出文件類型
        Icons:'glyphicon-export',
        exportOptions:{
            ignoreColumn: [0,1],  //忽略某一列的索引
            fileName: '總臺(tái)帳報(bào)表',  //文件名稱設(shè)置
            worksheetName: 'sheet1',  //表格工作區(qū)名稱
            tableName: '總臺(tái)帳報(bào)表',
            excelstyles: ['background-color', 'color', 'font-size', 'font-weight'],
            onMsoNumberFormat: DoOnMsoNumberFormat
        },
        columns: [
            {
                checkbox:true,
                title: '選擇'
            },{
                title: '序號(hào)',
                formatter: function (value, row, index) {
                    $(".group_sum").html(row['group_sum']);
                    $(".group_money_sum").html(row['group_money_sum']+"元");
                    $(".confirm_sum").html(row['confirm_sum']);
                    $(".confirm_money_sum").html(row['confirm_money_sum']+"元");
                    $(".refund_sum").html(row['refund_sum']);
                    $(".refund_money_sum").html(row['group_back_sum']+"元");
                    $(".residue_money_sum").html(row['residue_sum']+"元");
                    var a = index+1; return a+"<span style='display:none;'>"+row.id+"</span>"
                }
            },{
                field: 'project_name',
                align:"center",
                title: '項(xiàng)目'
            }, {
                field: 'user_name',
                align:"center",
                title: '姓名'
            }, {
                field: 'telephone',
                align:"center",
                title: '電話'
            },{
                field: 'id_card_number',
                align:"center",
                rowAttributes:"rowAttributes",
                title: '身份證號(hào)'
            },{
                field: 'telephone',
                align:"center",
                title: '手機(jī)號(hào)'
            },{
                field: 'pos_r_n',
                align:"center",
                title: 'POS機(jī)參考號(hào)'
            },{
                field: 'pos_c_n',
                align:"center",
                title: 'POS機(jī)終端號(hào)'
            },{
                field: 'merchant_code',
                align:"center",
                title: '商戶編碼'
            },{
                field: 'bank_card_number',
                align:"center",
                title: '銀行卡號(hào)'
            },{
                field: 'create_time',
                align:"center",
                title: '領(lǐng)取優(yōu)惠時(shí)間'
            },{
                field: 'group_purchase_number',
                align:"center",
                title: '優(yōu)惠編碼'
 
            },{
                field: 'group_purchase_expenses',
                align:"center",
                title: '會(huì)員費(fèi)用'
            },{
                field: 'back_pay_money',
                align:"center",
                title: '退款金額'
            },{
                field: 'refund_etime',
                align:"center",
                title: '退款時(shí)間'
            },{
                field: 'confirm_pay_money',
                align:"center",
                title: '認(rèn)購(gòu)金額'
            },{
                field: 'group_purchase_confirm_time',
                align:"center",
                title: '認(rèn)購(gòu)時(shí)間'
            },{
                field: 'room_confirm_number',
                align:"center",
                title: '認(rèn)購(gòu)房號(hào)'
            },{
                field: '',
                align:"center",
                title: '賬戶余額'
            },{
                field: 'invoice_status',
                align:"center",
                title: '發(fā)票狀態(tài)',
                formatter: 'invoice_status_formatter',
                events:'confirmEvents'
            },{
                field: 'lineson',
                align:"center",
                title: '數(shù)據(jù)來(lái)源',
                formatter: 'lineson_status_formatter',
                events:'confirmEvents'
            }
        ]
    });

上述就是小編為大家分享的如何實(shí)現(xiàn)bootstrap-table表格導(dǎo)出了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道。

文章名稱:如何實(shí)現(xiàn)bootstrap-table表格導(dǎo)出-創(chuàng)新互聯(lián)
分享地址:http://www.muchs.cn/article48/dpgeep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營(yíng)銷型網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航、企業(yè)建站微信小程序、做網(wǎng)站、關(guān)鍵詞優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都app開(kāi)發(fā)公司