From 0c85d7214e992fe83cad1f00dbeebc2f3a58d1eb Mon Sep 17 00:00:00 2001 From: Matthias Runge Date: Mon, 15 Oct 2012 09:52:32 +0200 Subject: [PATCH] Fixes JavaScript count bug in tables. When showing tables, and you had the summary, "No items to display", the counter at table footer says "Displaying 1 items". This commit fixes the inclusion of the empty line into line count. Affected sub-pages: Instances, Volumes, Images & Snapshots, etc. Change-Id: I24da50d506be477dffdbb0f497d88b1bd3ceacdc --- horizon/static/horizon/js/horizon.tables.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/horizon/static/horizon/js/horizon.tables.js b/horizon/static/horizon/js/horizon.tables.js index 1e167d310..7e3869ad7 100644 --- a/horizon/static/horizon/js/horizon.tables.js +++ b/horizon/static/horizon/js/horizon.tables.js @@ -180,7 +180,7 @@ horizon.datatables.update_footer_count = function (el, modifier) { else { $footer = $el.find('tr:last span:first'); } - row_count = $el.find('tbody tr:visible').length + modifier; + row_count = $el.find('tbody tr:visible').length + modifier - $el.find('.empty').length; footer_text_template = ngettext("Displaying %s item", "Displaying %s items", row_count); footer_text = interpolate(footer_text_template, [row_count]); $footer.text(footer_text); @@ -279,7 +279,7 @@ horizon.datatables.set_table_filter = function (parent) { horizon.addInitFunction(function() { horizon.datatables.validate_button(); - + horizon.datatables.update_footer_count($.find('table'),0); // Bind the "select all" checkbox action. $('div.table_wrapper, #modal_wrapper').on('click', 'table thead .multi_select_column :checkbox', function(evt) { var $this = $(this),