Skip to content

Instantly share code, notes, and snippets.

@vishwapriyanatha
Created April 27, 2017 06:11
Show Gist options
  • Save vishwapriyanatha/872d7bd27bb05df1e06d1b8525f16361 to your computer and use it in GitHub Desktop.
Save vishwapriyanatha/872d7bd27bb05df1e06d1b8525f16361 to your computer and use it in GitHub Desktop.
Angular DataTables add button in a cell (Row Edit button)
$scope.dtOptions = DTOptionsBuilder.fromSource('data.json')
.withDOM("<'row'<'col-sm-4'l><'col-sm-4 text-center'B><'col-sm-4'f>>tp")
.withButtons([
// {extend: 'copy',className: 'btn-sm'},
// {extend: 'csv',title: 'ExampleFile', className: 'btn-sm'},
// {extend: 'pdf', title: 'ExampleFile', className: 'btn-sm'},
// {extend: 'print',className: 'btn-sm'}
])
;
$scope.dtColumns = [
DTColumnBuilder.newColumn('Name').withTitle('Name'),
DTColumnBuilder.newColumn('Age').withTitle('Age'),
// ----------------- Add column with button ---------------
DTColumnBuilder.newColumn('id', '')
.renderWith(function (id) {
console.log(id);
return '<button>Edit</button>'
})
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment