Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * DataTables - Tables
- */
- $(function () {
- /* $('#multi-select').DataTable({
- responsive: true,
- "columnDefs": [{
- "orderable": false,
- "targets": [0, -1]
- }],
- });*/
- $('#multi-select').DataTable({
- "responsive": true,
- "lengthMenu": [
- [10, 25, 50, -1],
- [10, 25, 50, "All"]
- ]
- });
- });
- // Datatable click on select issue fix
- $(window).on('load', function () {
- $(".dropdown-content.select-dropdown li").on("click", function () {
- var that = this;
- setTimeout(function () {
- if ($(that).parent().parent().find('.select-dropdown').hasClass('active')) {
- // $(that).parent().removeClass('active');
- $(that).parent().parent().find('.select-dropdown').removeClass('active');
- $(that).parent().hide();
- }
- }, 100);
- });
- });
- var checkbox = $('#multi-select tbody tr th input');
- var selectAll = $('#multi-select .select-all');
- // Select A Row Function
- $(document).ready(function () {
- checkbox.on('click', function () {
- $(this).parent().parent().parent().toggleClass('selected');
- });
- checkbox.on('click', function () {
- if ($(this).attr("checked")) {
- $(this).attr('checked', false);
- } else {
- $(this).attr('checked', true);
- }
- });
- // Select Every Row
- selectAll.on('click', function () {
- $(this).toggleClass('clicked');
- if (selectAll.hasClass('clicked')) {
- $('#multi-select tbody tr').addClass('selected');
- } else {
- $('#multi-select tbody tr').removeClass('selected');
- }
- if ($('#multi-select tbody tr').hasClass('selected')) {
- checkbox.prop('checked', true);
- } else {
- checkbox.prop('checked', false);
- }
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement