亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

隱藏/顯示列后邊距數據表自行增加

隱藏/顯示列后邊距數據表自行增加

墨色風雨 2023-09-28 16:03:01
隱藏/顯示列后,邊距表數據自行增加。此結果在顯示/隱藏列之前。之后,我顯示/隱藏 10++ 次數據表 CSS 設置默認值table.dataTable {    width: 100%;    margin: 0 auto;}它從 5 開始,每次顯示或隱藏時加 1。我多次點擊后終于沒有人阻止它我的劇本var table = $('#table-result').DataTable({        responsive: true,        lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],        dom: 'Blfrtip',        buttons: [                    {            extend: 'collection',            text: 'Export',            buttons: [                'copy',                {                  extend: 'excel',                  title: titleExport                },                {                  extend: 'csv',                  title: titleExport                },                {                  extend: 'pdf',                  title: titleExport                }            ]          }        ],        rowReorder: true,        columnDefs: [            { orderable: true, className: 'reorder data-table-custom-font', targets: 0 },            { orderable: true, className: 'reorder data-table-custom-font', targets: 1 },            { orderable: false, className: 'data-table-custom-font', targets: '_all' }        ]      });這個腳本顯示/隱藏列  $('button.toggle-vis').on( 'click', function (e) {            e.preventDefault();                       // Get the column API object            let column = table.column( $(this).attr('data-column') );            console.log($(this).attr('data-column'))              // Toggle the visibility            column.visible( ! column.visible() );                        } );謝謝。如果您還想要更多東西,請告訴我。
查看完整描述

1 回答

?
慕桂英546537

TA貢獻1848條經驗 獲得超10個贊

我的答案設置樣式寬度:100%

<table class="table table-bordered table-striped hover" id="table-result" style="width:100%">



查看完整回答
反對 回復 2023-09-28
  • 1 回答
  • 0 關注
  • 136 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號