Use datatables button extension in AngularJS -
i've been using angularjs.datatables , want enable export excel/pdf. angularjs-datatables project include support tabletools extension read on datatables site tabletools retired , should use buttons purpose. can't seem find reference new extension being use angular anywhere. if can point out me how use it, i'll appreciate. if it's not possible use buttons, please share experience using tabletools. goal print , export excel/pdf customized columns (render differently between view , export)
thanks.
you have add required js file: - angular-datatables.buttons.min.js
and
add dependency datatables.buttons angular app
html:
<div ng-controller="withbuttonsctrl showcase"> <table datatable="" dt-options="showcase.dtoptions" dt-columns="showcase.dtcolumns" class="row-border hover"></table>
js:
angular.module('showcase.withbuttons', ['datatables', 'datatables.buttons']) .controller('withbuttonsctrl', withbuttonsctrl); function withbuttonsctrl(dtoptionsbuilder) { var vm = this; vm.dtoptions = dtoptionsbuilder.fromsource('data.json') .withdom('frtip') .withpaginationtype('full_numbers') // active buttons extension .withbuttons([ 'columnstoggle', 'colvis', 'copy', 'print', 'excel', { text: 'some button', key: '1', action: function (e, dt, node, config) { alert('button activated'); } } ]); }
reference: https://l-lin.github.io/angular-datatables/#/withbuttons
Comments
Post a Comment