使用DataTable的buttons功能會將原本的設定每頁顯示筆數下拉式選單移除問題。

原本是這樣:

加入buttons之後變這樣,原本的下拉式選單就這樣消失了。

--

上官網討論區找到解法:

在button宣告前要加上"dom":"Bfrtip"參數,改成"Blfrtip"(多加一個小寫"L",代表length changing input control)即可。

--

參考自 https://datatables.net/forums/discussion/29866/datatables-buttons-removes-the-length-menu

Bester Posts: 3Questions: 1Answers: 0

Here is what I used to add the buttons to the datatable for the export etc:
http://datatables.net/reference/button/#tabletools
Note the dom: 'Bfrtip', property does not have the letter 'L' in it.

Referring to this you will note that adding 'L' to the dom property adds the length selector:
http://datatables.net/reference/option/dom

So the final dom should look like this:

dom: 'Blfrtip',
(note the additional 'L' after the 'B' character)

This will give you the export buttons and you can also select the row count to show.

Hope this helps

arrow
arrow
    全站熱搜

    dizzy03 發表在 痞客邦 留言(0) 人氣()