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
This commit is contained in:
Matthias Runge 2012-10-15 09:52:32 +02:00
parent cb8e7c1f8f
commit 0c85d7214e

View File

@ -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),