From 4cfbd5bed8f3598fe3fb116682debd03ef30ca1f Mon Sep 17 00:00:00 2001 From: Gavsto Date: Wed, 27 Oct 2021 10:44:41 +0000 Subject: [PATCH] ENHANCEMENT: Filtering for Users Filtering added on the bottom column for users dataTable. --- js/datatables/datatablesusers.js | 26 ++++++++++++++++++++++++++ version_latest.txt | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/js/datatables/datatablesusers.js b/js/datatables/datatablesusers.js index d1fc932462d9..ad1b876b02ef 100644 --- a/js/datatables/datatablesusers.js +++ b/js/datatables/datatablesusers.js @@ -9,6 +9,26 @@ $(document).ready(function () { if (TenantID !== '') { $('.datatable-1').dataTable( { + initComplete: function () { + this.api().columns().every(function () { + var column = this; + var select = $('') + .appendTo($(column.footer()).empty()) + .on('change', function () { + var val = $.fn.dataTable.util.escapeRegex( + $(this).val() + ); + + column + .search(val ? '^' + val + '$' : '', true, false) + .draw(); + }); + + column.data().unique().sort().each(function (d, j) { + select.append('') + }); + }); + }, language: { paginate: { next: '', @@ -54,6 +74,12 @@ $(document).ready(function () { } } ], + 'columnDefs': [ + { + "targets": [2, 3, 4, 5], // your case first column + "className": "text-center align-middle" + } + ], "order": [[0, "asc"]], } ); diff --git a/version_latest.txt b/version_latest.txt index a5ba93251183..db152789702f 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -1.1.7 \ No newline at end of file +1.1.8 \ No newline at end of file