From f23e54292a673b2fd3f17d317c21984c753727c7 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Thu, 26 Nov 2015 15:59:01 +0000 Subject: [PATCH] toaster: tablejs Make sure click handlers consume click event Avoid the click event from propagating and causing strange side effects in toaster tables. [YOCTO #8527] [YOCTO #8148] Signed-off-by: Michael Wood Signed-off-by: Elliot Smith Signed-off-by: Richard Purdie --- lib/toaster/toastergui/static/js/table.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/toaster/toastergui/static/js/table.js b/lib/toaster/toastergui/static/js/table.js index 40b5022deb2..c69c205d50f 100644 --- a/lib/toaster/toastergui/static/js/table.js +++ b/lib/toaster/toastergui/static/js/table.js @@ -340,7 +340,8 @@ function tableInit(ctx){ } } - function sortColumnClicked(){ + function sortColumnClicked(e){ + e.preventDefault(); /* We only have one sort at a time so remove any existing sort indicators */ $("#"+ctx.tableName+" th .icon-caret-down").hide(); @@ -476,6 +477,7 @@ function tableInit(ctx){ }); $("#search-submit-"+ctx.tableName).click(function(e){ + e.preventDefault(); var searchTerm = $("#search-input-"+ctx.tableName).val(); tableParams.page = 1; @@ -489,8 +491,6 @@ function tableInit(ctx){ } loadData(tableParams); - - e.preventDefault(); }); $('.remove-search-btn-'+ctx.tableName).click(function(e){ @@ -514,7 +514,9 @@ function tableInit(ctx){ e.preventDefault(); }); - $("#clear-filter-btn-"+ctx.tableName).click(function(){ + $("#clear-filter-btn-"+ctx.tableName).click(function(e){ + e.preventDefault(); + var filterBtn = $("#" + tableParams.filter.split(":")[0]); filterBtnActive(filterBtn, false); -- 2.47.2