如何从angularJS数据表中的dtOptions访问表本身
我试图有一个csv下载按钮,需要从表中排除几列 我发现一个exportOptions定义了应该导出哪些列。 此选项来自jQuery DataTables和table.column方法,可能用于选择列 现在我需要选择某些列,但我无法找到如何使用角度数据表 有人知道答案吗如何从angularJS数据表中的dtOptions访问表本身,angularjs,angular-datatables,Angularjs,Angular Datatables,我试图有一个csv下载按钮,需要从表中排除几列 我发现一个exportOptions定义了应该导出哪些列。 此选项来自jQuery DataTables和table.column方法,可能用于选择列 现在我需要选择某些列,但我无法找到如何使用角度数据表 有人知道答案吗 <table dt-options="dtOptions" dt-column-defs="dtColumnDef"> <thead> <tr>
<table dt-options="dtOptions" dt-column-defs="dtColumnDef">
<thead>
<tr>
<th>hoo</th>
<th>hoo</th>
</tr>
</thead>
<tbody>
<tr>
<td>hoo</td>
<td>hoo</td>
</tr>
</tbody>
</table>
<script>
// here is inside my controller
$scope.dtOptions = DTOptionsBuilder
.newOptions()
.withDOM('tB')
.withButtons([
{
text: 'download csv',
extend: 'csv',
exportOptions:
{
// columns: I neet to select certain columns here
// wiht method like "table.columns(0)" mentioned in jQuery datatables document
// but I don't know how in angular-datatables
}
}]);
</script>
我使用角度方式渲染表。角度方式和纯jQuery数据表之间没有区别。并且您不需要访问exportOptions中的表实例。你需要的是归还一张支票;以下是一些不知道您正试图做什么的示例:
exportOptions: {
columns: [0,4,5] //some columns by index
}
exportOptions: {
columns: 'th' //any column
}
exportOptions: {
columns: ['th:eq(1)', 'th:eq(5)'] //same as numbered array
}
exportOptions: {
columns: 'th:not(:first)' //exclude the first column
}
exportOptions: {
columns: 'th:not(.no-export)' //exclude columns with class no-export
}
等等。有人有提示吗?这是点击事件处理程序的解决方案吗!?或者单击下一步按钮