From 5f37af8fd1524667eabf65fb0e26c239a0812b83 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 20 Mar 2018 11:50:44 +0530 Subject: [PATCH] Fixes for multiple datatables overlapping function call points --- .../public/js/dataTables.extended.js | 8 ++++---- .../public/js/dataTables.extended.serversidepaging.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js index 39141115258..e39e54a9307 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js @@ -232,14 +232,14 @@ $.fn.datatables_extended = function (settings) { /** * append advance operations to list table toolbar */ - $('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html( + table.closest('.dataTables_wrapper').find('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html( getAdvanceToolBar() ); /** * sorting dropdown menu select function */ - $('.dataTables_wrapper .sort-list li a').click(function () { + table.closest('.dataTables_wrapper').find('.sort-list li a').click(function () { $(this).closest('li').siblings('li').find('a').removeClass('sorting_asc').removeClass('sorting_desc'); var thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); @@ -263,7 +263,7 @@ $.fn.datatables_extended = function (settings) { /** * Enable/Disable selection on rows */ - $('.dataTables_wrapper [data-click-event=toggle-selectable]').click(function () { + table.closest('.dataTables_wrapper').find('[data-click-event=toggle-selectable]').click(function () { var button = this, thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); if ($(button).html() == 'Select') { @@ -286,7 +286,7 @@ $.fn.datatables_extended = function (settings) { /** * select/deselect all rows function */ - $('.dataTables_wrapper [data-click-event=toggle-selected]').click(function () { + table.closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').click(function () { var button = this, thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); if ($(button).html() == 'Select All') { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js index 4060d61f639..f23559fe284 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js @@ -297,7 +297,7 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter /** * sorting dropdown menu select function */ - $('.dataTables_wrapper .sort-list li a').click(function () { + table.closest('.dataTables_wrapper').find('.sort-list li a').click(function () { $(this).closest('li').siblings('li').find('a').removeClass('sorting_asc').removeClass('sorting_desc'); var thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); @@ -321,7 +321,7 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter /** * Enable/Disable selection on rows */ - $('.dataTables_wrapper [data-click-event=toggle-selectable]').click(function () { + table.closest('.dataTables_wrapper').find('[data-click-event=toggle-selectable]').click(function () { var button = this, thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); if ($(button).html() == 'Select') { @@ -345,7 +345,7 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter /** * select/deselect all rows function */ - $('.dataTables_wrapper [data-click-event=toggle-selected]').click(function () { + table.closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').click(function () { var button = this, thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); if (!$(button).hasClass('disabled')) {