-1

I am rendering my DataTable the angular way, I added a select all checkbox at the top and per row I added a checkbox and number textbox.

If the checkbox per row is checked then the number textbox would be enabled.

The problem is that for example, I check selectAll then the checkbox per row would be checked but the number textbox remains disabled. I checked the value of the checkbox per row and it was false even though the checkbox was checked.

I cannot remove the api.rows({search:'applied'}) code and just change the value of the checkbox per row using for or angular.forEach because for example the user filters the result using the checkbox and then the user clicked selectAll then it should only check the filtered results.

see plunker.

This was tagged duplicate but the problem is different. My problem was that I changed the prop of the checkbox per row in my datatable.

Len
  • 534
  • 1
  • 15
  • 31
  • 1
    @BhaskarRajoriya the problem is different. My problem was that I changed the prop of the checkbox per row in my datatable. – Len Aug 29 '18 at 06:39

1 Answers1

2

You should change the ng-model value for each data row and not the checked prop of checkbox.

Angularjs is model driven, you should always change data, it will automatically reflect on UI as per bindings.

Please check this updated plunkr

Ashish
  • 1,111
  • 8
  • 18
  • 1
    This fixed my ng-disabled problem but the selectAll checkbox should only check the filtered items. for example I searched 'Accountant', it will return two results so if I checked the selectAll checkbox it should only check the filtered items (the two results) but it checks all the results because the api search applied code is commented. – Len Aug 29 '18 at 06:49