jquery - dataTables : javascript not working while paging -
i using datatable creating table , working fine. table consists of checkbox (column1) , select (last column). javascript enable select when checkbox selected. while page next page, javascript of enabling/disabling not working. selects enabled.
javascript
<script> var update_selectopt=function(){ $("tr").each(function(){ if($("input[type='checkbox']", this).is(":checked")){ $('#select',this).removeattr('disabled'); } else { $('#select',this).attr('disabled','disabled'); } }); }; $(update_selectopt); $("input[type='checkbox']").on("click",update_selectopt); </script>
how manage that?
fire update_selectopt
function after paging event has happened on table:
$('#table_ws').on( 'page.dt', function () { update_selectopt(); });
edit
try this:
$('#table_ws').on( 'draw.dt', function () { update_selectopt(); });
documentation on page event here
Comments
Post a Comment