検索
ホームページウェブフロントエンドブートストラップのチュートリアルブートストラップテーブルテーブルのエクスポート

ブートストラップテーブルテーブルのエクスポート

  在bootstrap-table官网-》拓展模块中有导出模块的详细介绍。网址:http://bootstrap-table.wenzhixin.net.cn/zh-cn/extensions/

  点击home按钮进入github官方文档,会看到导出使用的插件是bootstrap-table-export.js  ,而这个插件中使用的是tableExport.jquery.plugin插件。后者是一个独立的表格导出插件。而前者是经过bootstrap官方将后者与bootstrap表格进行了完美的整合之后的插件。所以我们只需要使用前者即可。

文档参数说明:

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   //导出表格方式(默认basic:只导出当前页的表格数据;all:导出所有数据;selected:导出选中的数据)

  • type: String

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

  • default: basic

exportTypes   //导出文件类型 ,支持多种类型文件导出

  • 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  //导出的表格参数设置,这里参照tableExport.jquery.plugin插件中的参数进行设置,点击官网文档中的option蓝色字体就可跳转到该插件的说明文档处,网址:https://github.com/hhurz/tableExport.jquery.plugin#options。

  • type: Object

  • description: export options of tableExport.jquery.plugin

  • default: {}

Icons     //导出按钮图标设置

  • export: 'glyphicon-export icon-share'

下面直接贴代码:

//查询
    function refresh(){
        $("#datatable").bootstrapTable(&#39;refresh&#39;,{url:&#39;__MODULE__/Statistics/listData&#39;});
    }
    //查询条件
    function queryParams(params){
        params[&#39;project_id&#39;] = $("select[name=project_id]").find("option:selected").val();
        params[&#39;time_field&#39;] = $("select[name=time_field]").find("option:selected").val();
        params[&#39;start_time&#39;] = $("input[name=start_time]").val();
        params[&#39;end_time&#39;] = $("input[name=end_time]").val();
        params[&#39;user_name&#39;] = $("input[name=user_name]").val();
        params[&#39;telephone&#39;] = $("input[name=telephone]").val();
        params[&#39;room_confirm_number&#39;] = $("input[name=room_confirm_number]").val();
        params[&#39;lineson&#39;] = $("select[name=lineson]").val();
        params[&#39;invoice&#39;] = $("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: &#39;__MODULE__/Statistics/listData&#39;,  //表格数据请求地址
        pagination:true,   //是否分页
        search: false,    //是否显示查询框
        sortName: "id",    //排序相关
        sortOrder: "desc",
        queryParams:&#39;queryParams&#39;,
        method:"post",
        sortable:true,
        dataType:&#39;json&#39;,
        toolbar: "#exampleTableEventsToolbar",
        icons: {refresh: "glyphicon-repeat", toggle: "glyphicon-list-alt", columns: "glyphicon-list"},
        pageList:[10, 25, 50, 100],
        clickToSelect:true,
        exportDataType:&#39;all&#39;,
 
        onLoadSuccess:function(data){   //表格数据加载成功事件
            rowCount = data.length-1;
            $("#datatable").bootstrapTable(&#39;hideRow&#39;, {index:rowCount});
            $("#datatable td").attr("data-tableexport-msonumberformat","\@");
            $("#datatable tr").attr("data-tableexport-display","always");
        },
        onPageChange:function(number,size){  //表格翻页事件
            $("#datatable").bootstrapTable(&#39;hideRow&#39;, {index:rowCount});
            $("#datatable td").attr("data-tableexport-msonumberformat","\@");
            $("#datatable tr").attr("data-tableexport-display","always");
 
        },
        showExport: true,  //是否显示导出按钮
        buttonsAlign:"right",  //按钮位置
        exportTypes:[&#39;excel&#39;],  //导出文件类型
        Icons:&#39;glyphicon-export&#39;,
        exportOptions:{
            ignoreColumn: [0,1],  //忽略某一列的索引
            fileName: &#39;总台帐报表&#39;,  //文件名称设置
            worksheetName: &#39;sheet1&#39;,  //表格工作区名称
            tableName: &#39;总台帐报表&#39;,
            excelstyles: [&#39;background-color&#39;, &#39;color&#39;, &#39;font-size&#39;, &#39;font-weight&#39;],
            onMsoNumberFormat: DoOnMsoNumberFormat
        },
        columns: [
            {
                checkbox:true,
                title: &#39;选择&#39;
            },{
                title: &#39;序号&#39;,
                formatter: function (value, row, index) {
                    $(".group_sum").html(row[&#39;group_sum&#39;]);
                    $(".group_money_sum").html(row[&#39;group_money_sum&#39;]+"元");
                    $(".confirm_sum").html(row[&#39;confirm_sum&#39;]);
                    $(".confirm_money_sum").html(row[&#39;confirm_money_sum&#39;]+"元");
                    $(".refund_sum").html(row[&#39;refund_sum&#39;]);
                    $(".refund_money_sum").html(row[&#39;group_back_sum&#39;]+"元");
                    $(".residue_money_sum").html(row[&#39;residue_sum&#39;]+"元");
                    var a = index+1; return a+"<span style=&#39;display:none;&#39;>"+row.id+"</span>"
                }
            },{
                field: &#39;project_name&#39;,
                align:"center",
                title: &#39;项目&#39;
            }, {
                field: &#39;user_name&#39;,
                align:"center",
                title: &#39;姓名&#39;
            }, {
                field: &#39;telephone&#39;,
                align:"center",
                title: &#39;电话&#39;
            },{
                field: &#39;id_card_number&#39;,
                align:"center",
                rowAttributes:"rowAttributes",
                title: &#39;身份证号&#39;
            },{
                field: &#39;telephone&#39;,
                align:"center",
                title: &#39;手机号&#39;
            },{
                field: &#39;pos_r_n&#39;,
                align:"center",
                title: &#39;POS机参考号&#39;
            },{
                field: &#39;pos_c_n&#39;,
                align:"center",
                title: &#39;POS机终端号&#39;
            },{
                field: &#39;merchant_code&#39;,
                align:"center",
                title: &#39;商户编码&#39;
            },{
                field: &#39;bank_card_number&#39;,
                align:"center",
                title: &#39;银行卡号&#39;
            },{
                field: &#39;create_time&#39;,
                align:"center",
                title: &#39;领取优惠时间&#39;
            },{
                field: &#39;group_purchase_number&#39;,
                align:"center",
                title: &#39;优惠编码&#39;
 
            },{
                field: &#39;group_purchase_expenses&#39;,
                align:"center",
                title: &#39;会员费用&#39;
            },{
                field: &#39;back_pay_money&#39;,
                align:"center",
                title: &#39;退款金额&#39;
            },{
                field: &#39;refund_etime&#39;,
                align:"center",
                title: &#39;退款时间&#39;
            },{
                field: &#39;confirm_pay_money&#39;,
                align:"center",
                title: &#39;认购金额&#39;
            },{
                field: &#39;group_purchase_confirm_time&#39;,
                align:"center",
                title: &#39;认购时间&#39;
            },{
                field: &#39;room_confirm_number&#39;,
                align:"center",
                title: &#39;认购房号&#39;
            },{
                field: &#39;&#39;,
                align:"center",
                title: &#39;账户余额&#39;
            },{
                field: &#39;invoice_status&#39;,
                align:"center",
                title: &#39;发票状态&#39;,
                formatter: &#39;invoice_status_formatter&#39;,
                events:&#39;confirmEvents&#39;
            },{
                field: &#39;lineson&#39;,
                align:"center",
                title: &#39;数据来源&#39;,
                formatter: &#39;lineson_status_formatter&#39;,
                events:&#39;confirmEvents&#39;
            }
        ]
    });

推荐相关教程:bootstrap使用

以上がブートストラップテーブルテーブルのエクスポートの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
ブートストラップをReactに統合する:実用的なガイドブートストラップをReactに統合する:実用的なガイドApr 25, 2025 am 12:04 AM

BootstrapをReactプロジェクトに統合する手順には次のものがあります。1。ブートストラップパッケージをインストールします。2。CSSファイルをインポートします。3。ブートストラップクラス名をスタイル要素に使用します。この統合は、Reactのコンポーネント化とブートストラップのスタイルシステムを利用して、効率的なUI開発を実現します。

ブートストラップは何に使用されますか?実用的な説明ブートストラップは何に使用されますか?実用的な説明Apr 24, 2025 am 12:16 AM

bootstrapisapowerfulframeworkthatsimplifiessimponsive、mobile-firstwebsites.itoffers:1)agridsystemforadaptablelayouts、2)styledelements likebuttonsansandsforms、and3)javascriptcomponentssuchascascarouselsersivity。

ブートストラップ:レイアウトからコンポーネントまでブートストラップ:レイアウトからコンポーネントまでApr 23, 2025 am 12:06 AM

Bootstrapは、HTML、CSS、JavaScriptを統合して、開発者がレスポンシブWebサイトを迅速に構築できるようにするTwitterが開発したフロントエンドフレームワークです。そのコア関数には、グリッドシステムとレイアウト:12列の設計、FlexBoxレイアウトの使用、さまざまなデバイスサイズのレスポンシブページのサポートに基づいています。コンポーネントとスタイル:ボタン、モーダルボックスなどのコンポーネントの豊富なライブラリを提供し、クラス名を追加することで美しい効果を達成できます。それがどのように機能するか:CSSとJavaScriptに依存しているCSSは、より少ないまたはSASSの前処理を使用し、JavaScriptはJQUERYに依存してインタラクティブで動的な効果を実現します。これらの機能を通じて、ブートストラップは開発を大幅に改善します

ブートストラップとは何ですか?初心者向けの紹介ブートストラップとは何ですか?初心者向けの紹介Apr 22, 2025 am 12:07 AM

bootstrapisafreecsframeworkthatsは、wevevidementbovidingprovidingpre-scomponentsandjavascriptplugins.it.sidealfor forcreatingResponsive、Mobile-firstwebsites、提供可能なgridsystemsystemSystemforlayoutsandasuoutsutivortiveportivedization forlearning customustomizationを提供します。

Bootstrap Demystified:簡単な説明Bootstrap Demystified:簡単な説明Apr 21, 2025 am 12:13 AM

Bootstrapisafree、open-sourcessframeworkthathelpscreatersive、mobile-firstwebsites.1)itoffersigridsystemforlayoutfflexibility、2)forquickdesignを含む、3)ishighlycustomizableoavoidoavoidoidolooks、

ブートストラップvs. React:適切なアプローチを選択しますブートストラップvs. React:適切なアプローチを選択しますApr 20, 2025 am 12:09 AM

Bootstrapは迅速な建設や小規模プロジェクトに適していますが、Reactは複雑でインタラクティブなアプリケーションに適しています。 1)ブートストラップは、事前に定義されたCSSおよびJavaScriptコンポーネントを提供して、応答性のあるインターフェイス開発を簡素化します。 2)Reactは、コンポーネント開発と仮想DOMを通じてパフォーマンスとインタラクティブ性を向上させます。

Bootstrapの目的:一貫した魅力的なWebサイトの構築Bootstrapの目的:一貫した魅力的なWebサイトの構築Apr 19, 2025 am 12:07 AM

Bootstrapの主な目的は、開発者がレスポンシブでモバイルファーストのWebサイトを迅速に構築できるようにすることです。そのコア関数には、次のものが含まれます。1。グリッドシステムを介したさまざまなデバイスのレイアウト調整を実現するレスポンシブ設計。 2。ナビゲーションバーやモーダルボックスなどの事前定義されたコンポーネントは、美学とクロスブラウザーの互換性を確保します。 3.カスタマイズと拡張機能をサポートし、SASS変数とミックスインを使用してスタイルを調整します。

Bootstrap vs.その他のフレームワーク:比較概要Bootstrap vs.その他のフレームワーク:比較概要Apr 18, 2025 am 12:06 AM

Bootstrapは、使いやすく、レスポンシブWebサイトをすばやく開発できるため、Tailwindcss、Foundation、およびBulmaよりも優れています。 1.BootStrapは、事前に定義されたスタイルとコンポーネントの豊富なライブラリを提供します。 2。そのCSSおよびJavaScriptライブラリは、レスポンシブデザインとインタラクティブな機能をサポートしています。 3.迅速な発展に適していますが、カスタムスタイルはより複雑になる場合があります。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

SecLists

SecLists

SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

SublimeText3 Linux 新バージョン

SublimeText3 Linux 新バージョン

SublimeText3 Linux 最新バージョン

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)