Skip to content Skip to sidebar Skip to footer

Add A Checkbox In Each Row For Datatable Jquery Using Angular.js

What I want is, I want to display some data in a datatable format by using angular js. So I did something like below. Angular And Controller public ActionResult getdata() {

Solution 1:

As mentioned by yujinpan you can use the select extension. Or simply just render out a checkbox yourself:

$scope.dtcolumns = [
  dtcolumnbuilder.newcolumn(null, '').renderWith(function(data, type, full)
     return'<input type="checkbox" class="check" data-object-id="'+full.objectid+'">'
  }),
  dtcolumnbuilder.newcolumn("objectid", "id"),
  ...
]

Now you can associate delegated event handlers with the checkboxes through the .check class.


Use a dtInstance as explained here or in the docs here (look at the bottom of page). Now you could do something like

$('#entry-grid').on('click', '.check', function() {
   var data = $scope.dtInstance.DataTable.row($(this).closest('tr')).data()
})

Solution 2:

Is it this one?the select plugin. withSelect

Post a Comment for "Add A Checkbox In Each Row For Datatable Jquery Using Angular.js"