diff --git a/js/tbl_structure.js b/js/tbl_structure.js index cda6d43dd1..f146e1bdca 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -596,6 +596,8 @@ function moreOptsMenuResize() { $table_clone = $table.clone(); } + $table.find("td.more_opts").hide(); + var getCurWidth = function() { var cur_width = 0; $table.find("tr").eq(1) @@ -608,13 +610,15 @@ function moreOptsMenuResize() { // get window width var window_width = $(window).width(); + // find out maximum action links width var max_width = window_width; - $table.find("th").each(function () { - if ($(this).index() < 8) { + $table.find("tr").eq(0).children().each(function () { + if ($(this).index() < 9) { max_width -= $(this).outerWidth() + 1; } }); + // current action links width var cur_width = getCurWidth(); @@ -629,6 +633,7 @@ function moreOptsMenuResize() { $table.find("." + css_class.join(".")).hide(); // show corresponding more-menu entry $table.find(".replace_in_more.action_" + css_class[0]).show(); + $table.find("td.more_opts").show(); // recalculate width cur_width = getCurWidth(); } @@ -637,9 +642,6 @@ function moreOptsMenuResize() { if ($(".replaced_by_more:hidden").length == 0) { $table.find("td.more_opts").hide(); } - else { - $table.find("td.more_opts").show(); - } // Position the dropdown $(".structure_actions_dropdown").each(function() {