The checkAll click function works, however, the uncheckAll click function does not. Anybody see what is preventing it from unchecking all the checkboxes that are checked.
$('#checkAll').click(function (e) {
e.preventDefault();
$('#dataTablePageList :checkbox').attr('checked','checked');
$(this).removeAttr('id').attr('id','uncheckAll');
$(this).find('strong').html('Uncheck All Checkboxes');
});
$('#uncheckAll').click(function (e) {
e.preventDefault();
$('#dataTablePageList :checkbox').removeAttr("checked");
$(this).removeAttr('id').attr('id','checkAll');
$(this).find('strong').html('Check All Checkboxes');
});
EDIT:
I tried this however for some reason it doesn’t do anything. Not sure why.
$('#dataTablePageList').delegate('#checkAll', 'click', function(e) {
e.preventDefault();
$('#dataTablePageList :checkbox').attr('checked',true);
$(this).removeAttr('id').attr('id','uncheckAll');
$(this).find('strong').html('Uncheck All Checkboxes');
});
$('#dataTablePageList').delegate('#uncheckAll', 'click', function(e) {
e.preventDefault();
$('#dataTablePageList :checkbox').attr('checked',false);
$(this).removeAttr('id').attr('id','checkAll');
$(this).find('strong').html('Check All Checkboxes');
});
Edit 3:
$('#viewAll').live('click', function(e) {
e.preventDefault();
oTable.fnLengthChange(-1);
$(this).removeClass('viewAll').addClass('paginateRecords');
$(this).find('strong').html('View Paginated Records');
$('.pagination').hide();
});
$('#paginateRecords').live('click', function(e) {
e.preventDefault();
oTable.fnLengthChange(10);
$(this).removeClass('paginateRecords').addClass('viewAll');
$(this).find('strong').html('View All Records');
$('.pagination').show();
});
event
clickis binded to DOM element, not every css-match now-or-in-future, so on the first run, only#checkAllwould be binded, and latter would not be used at alltry another way – by using toggle on check element
as for edit3:
toggle() take as parameters two functions which are run alternately after subsequent clicks