i have function if user clicks on pagination links of dynatable (page numbers, previous, next) disable couple of fields updates based on status. here function call:
$(document).on('click', '.dynatable-page-link', function() { var statuscheck = $('#updcmdstatus').val(); alert ("enter function on dynatable page link") ; if (statuscheck === "cp" || statuscheck === "vp") { $('table#checkedtable input[type=checkbox]').attr('disabled','true'); $('table#checkedtable input[type=text]').attr('disabled','true'); $('table#checkedtable select[id^=modify]').attr('disabled','true'); } else { $('table#checkedtable input[type=checkbox]').removeattr("disabled"); } });
i know processing working when load page because disabled 3 fields. know looking @ alert box accessing function @ right time. doesn't input or select boxes being disabled when clicking. tried debug on document.getelementbyid("checkedtable").rows[1].cells[1] (a check box field) , attributes showing disabled = false. guess confusing why working on page load not in function tied pagination.
thanks again.
you passing string value instead of bool in attr function should prop function.
here 2 fixes.
- using
.attr()
$('table#checkedtable input[type=checkbox]').attr('disabled','disabled'); $('table#checkedtable input[type=text]').attr('disabled','disabled'); $('table#checkedtable select[id^=modify]').attr('disabled','disabled'); $('table#checkedtable input[type=checkbox]').removeattr("disabled");
- using
.prop()
$('table#checkedtable input[type=checkbox]').prop('disabled',true); $('table#checkedtable input[type=text]').prop('disabled',true); $('table#checkedtable select[id^=modify]').prop('disabled',true); $('table#checkedtable input[type=checkbox]').prop("disabled",false);