oTable = $('.dTableAjax').dataTable({ "sAjaxSource": "po-component/po-video/datatable.php", "sDom": "<'row'<'col-sm-6 col-xs-5'l><'col-sm-6 col-xs-7'f>r>t<'row'<'col-sm-5 hidden-xs'i><'col-sm-7 col-xs-12 clearfix'p>>", "sPaginationType": "bootstrap", "oLanguage": { "sLengthMenu": "_MENU_", "sSearch": '
_INPUT_
', "sInfo": "_START_-_END_ of _TOTAL_", "oPaginate": { "sPrevious": "", "sNext": "" } }, "bJQueryUI": false, "bAutoWidth": false, "aaSorting": [[2, "desc"]], "bStateSave": true, "bServerSide": true, "iDisplayLength": 10, "aLengthMenu": [ [10, 30, 50, -1], [10, 30, 50, "All"] ], "fnDrawCallback": function( oSettings ) { $("#titleCheck").click(function() { var checkedStatus = this.checked; $("table tbody tr td div:first-child input[type=checkbox]").each(function() { this.checked = checkedStatus; if (checkedStatus == this.checked) { $(this).closest('table tbody tr').removeClass('danger'); $(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked); $('#totaldata').val($('form input[type=checkbox]:checked').size()); } if (this.checked) { $(this).closest('table tbody tr').addClass('danger'); $(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked); $('#totaldata').val($('form input[type=checkbox]:checked').size()); } }); }); $('table tbody tr td div:first-child input[type=checkbox]').on('click', function () { var checkedStatus = this.checked; this.checked = checkedStatus; if (checkedStatus == this.checked) { $(this).closest('table tbody tr').removeClass('danger'); $(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked); $('#totaldata').val($('form input[type=checkbox]:checked').size()); } if (this.checked) { $(this).closest('table tbody tr').addClass('danger'); $(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked); $('#totaldata').val($('form input[type=checkbox]:checked').size()); } }); $('table tbody tr td div:first-child input[type=checkbox]').change(function() { $(this).closest('tr').toggleClass("danger", this.checked); }); $(".alertdel").click(function(){ var id = $(this).attr("id"); $('#alertdel').modal('show'); $('#delid').val(id); }); } });