在bootstrap-table官网-》拓展模块中有导出模块的详细介绍。
点击home按钮进入github官方文档,会看到导出使用的插件是bootstrap-table-export.js ,而这个插件中使用的是tableExport.jquery.plugin插件。后者是一个独立的表格导出插件。(推荐学习:Bootstrap视频教程)
而前者是经过bootstrap官方将后者与bootstrap表格进行了完美的整合之后的插件。所以我们只需要使用前者即可。
<script></script>
下面直接贴代码:
//查询 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', //表格数据请求地址 pagination:true, //是否分页 search: false, //是否显示查询框 sortName: "id", //排序相关 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){ //表格数据加载成功事件 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){ //表格翻页事件 $("#datatable").bootstrapTable('hideRow', {index:rowCount}); $("#datatable td").attr("data-tableexport-msonumberformat","\@"); $("#datatable tr").attr("data-tableexport-display","always"); }, showExport: true, //是否显示导出按钮 buttonsAlign:"right", //按钮位置 exportTypes:['excel'], //导出文件类型 Icons:'glyphicon-export', exportOptions:{ ignoreColumn: [0,1], //忽略某一列的索引 fileName: '总台帐报表', //文件名称设置 worksheetName: 'sheet1', //表格工作区名称 tableName: '总台帐报表', excelstyles: ['background-color', 'color', 'font-size', 'font-weight'], onMsoNumberFormat: DoOnMsoNumberFormat }, columns: [ { checkbox:true, title: '选择' },{ title: '序号', 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>"+row.id+"</span>" } },{ field: 'project_name', align:"center", title: '项目' }, { field: 'user_name', align:"center", title: '姓名' }, { field: 'telephone', align:"center", title: '电话' },{ field: 'id_card_number', align:"center", rowAttributes:"rowAttributes", title: '身份证号' },{ field: 'telephone', align:"center", title: '手机号' },{ field: 'pos_r_n', align:"center", title: 'POS机参考号' },{ field: 'pos_c_n', align:"center", title: 'POS机终端号' },{ field: 'merchant_code', align:"center", title: '商户编码' },{ field: 'bank_card_number', align:"center", title: '银行卡号' },{ field: 'create_time', align:"center", title: '领取优惠时间' },{ field: 'group_purchase_number', align:"center", title: '优惠编码' },{ field: 'group_purchase_expenses', align:"center", title: '会员费用' },{ field: 'back_pay_money', align:"center", title: '退款金额' },{ field: 'refund_etime', align:"center", title: '退款时间' },{ field: 'confirm_pay_money', align:"center", title: '认购金额' },{ field: 'group_purchase_confirm_time', align:"center", title: '认购时间' },{ field: 'room_confirm_number', align:"center", title: '认购房号' },{ field: '', align:"center", title: '账户余额' },{ field: 'invoice_status', align:"center", title: '发票状态', formatter: 'invoice_status_formatter', events:'confirmEvents' },{ field: 'lineson', align:"center", title: '数据来源', formatter: 'lineson_status_formatter', events:'confirmEvents' } ] });
更多Bootstrap相关技术文章,请访问Bootstrap教程栏目进行学习!
以上是bootstrap表格匯出怎麼設定的詳細內容。更多資訊請關注PHP中文網其他相關文章!

bootstrapisapowerfulflameworkthatsimplifiesCreatingingResponsive,移動 - firstwebsites.itoffers.itoffers:1)AgridSystemforadaptableBableLayouts,2)2)pre-styledlementslikeButtonslikeButtonSandForms和3)JavaScriptCompriptcomponcomponentsSuchcaroSelSuselforEnhanceSuch forenhanceTinteractivity。

Bootstrap是一個由Twitter開發的前端框架,集成了HTML、CSS和JavaScript,幫助開發者快速構建響應式網站。其核心功能包括:柵格系統與佈局:基於12列的設計,使用flexbox佈局,支持不同設備尺寸的響應式頁面。組件與樣式:提供豐富的組件庫,如按鈕、模態框等,通過添加類名即可實現美觀效果。工作原理:依賴CSS和JavaScript,CSS使用LESS或SASS預處理器,JavaScript依賴jQuery,實現交互和動態效果。通過這些功能,Bootstrap大大提升了開發

BootstrapisafreeCSSframeworkthatsimplifieswebdevelopmentbyprovidingpre-styledcomponentsandJavaScriptplugins.It'sidealforcreatingresponsive,mobile-firstwebsites,offeringaflexiblegridsystemforlayoutsandasupportivecommunityforlearningandcustomization.

Bootstrapisafree,open-sourceCSSframeworkthathelpscreateresponsive,mobile-firstwebsites.1)Itoffersagridsystemforlayoutflexibility,2)includespre-styledcomponentsforquickdesign,and3)ishighlycustomizabletoavoidgenericlooks,butrequiresunderstandingCSStoop

Bootstrap適合快速搭建和小型項目,而React適合複雜的、交互性強的應用。 1)Bootstrap提供預定義的CSS和JavaScript組件,簡化響應式界面開發。 2)React通過組件化開發和虛擬DOM,提升性能和交互性。

Bootstrap的主要用途是幫助開發者快速構建響應式、移動優先的網站。其核心功能包括:1.響應式設計,通過網格系統實現不同設備的佈局調整;2.預定義組件,如導航欄和模態框,確保美觀和跨瀏覽器兼容性;3.支持自定義和擴展,使用Sass變量和mixins調整樣式。

Bootstrap優於TailwindCSS、Foundation和Bulma,因為它易用且快速開發響應式網站。 1.Bootstrap提供豐富的預定義樣式和組件庫。 2.其CSS和JavaScript庫支持響應式設計和交互功能。 3.適合快速開發,但自定義樣式可能較複雜。

在React項目中整合Bootstrap可以通過兩種方法:1)使用CDN引入,適合小型項目或快速原型設計;2)使用npm包管理器安裝,適用於需要深度定制的場景。通過這些方法,你可以在React中快速構建美觀且響應式的用戶界面。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

記事本++7.3.1
好用且免費的程式碼編輯器

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),