datatables tabletools -> export only selected rows

妖精的绣舞 提交于 2019-12-11 10:02:05

问题


I am using datatables with tabletools on a large table which is filled via ajax request.

When user selects several rows, it shows them as selected in the table.

How can i tell the csv/xls export to ONLY export the selected rows?

Thanks in advance


回答1:


Stupid me...

Just got it:

            {
                "sExtends": "csv",
                "bSelectedOnly": true
            }



回答2:


If for somebody like me bSelectedOnly is not working (e.g always all rows are copied when only certain selected), before you burn into cry, just check if your run 2.2.3 version of dataTables.tableTools.js becuase there was bug corrected in this release: https://github.com/DataTables/TableTools/commit/a9afb46cb00417db6d0fd6d7697e5d28830bc959

Fix #48: `bSelectedOnly` option was not working in 1.10.
* Fix is to use the new `fnGetSelectedIndexes` which gives the
  information required for `bSelectedOnly` when needed.


来源:https://stackoverflow.com/questions/13498489/datatables-tabletools-export-only-selected-rows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!