Excluding last column of jQuery DataTables.net TableTools

前端 未结 5 850
挽巷
挽巷 2021-01-16 18:43

Question: How can I exclude the last column of jQuery DataTables.net when using the TableTools extras to export?

Details

I\

5条回答
  •  终归单人心
    2021-01-16 19:12

    Just for googlers: in tabletools 2.2.3 you can now use function for mColumns

    var dataTable = $grdData.DataTable({
         tableTools: {
              aButtons: [{
                  "sExtends": "csv",
                  "sButtonText": "csv",
                  "mColumns": function ( dtSettings ) {
                       var api = new $.fn.dataTable.Api( dtSettings );
    
                       return api.columns(":not(:last)").indexes().toArray();
                  }
              }]
         }
    });
    

提交回复
热议问题