Fixes a js error when tables loaded on the page are empty.

Fixes bug 1037289.

Change-Id: I3edc7aa825b225bf4d623e4f046d6e40a918492b
This commit is contained in:
Gabriel Hurley 2012-08-15 13:58:44 -07:00
parent d854ea0f55
commit 629316f4a3
2 changed files with 3 additions and 3 deletions

View File

@ -258,7 +258,7 @@ horizon.datatables.set_table_filter = function (parent) {
horizon.datatables.update_footer_count(table);
// Add a "no results" row if there are no results.
template = horizon.templates.compiled_templates["#empty_row_template"];
if (!$(table_selector + " tbody tr:visible").length && typeof(template) !== undefined) {
if (!$(table_selector + " tbody tr:visible").length && typeof(template) !== "undefined") {
colspan = table.find("th[colspan]").attr('colspan');
params = {"colspan": colspan};
table.find("tbody").append(template.render(params));

View File

@ -1,9 +1,9 @@
/* Utilities for common needs which aren't JS builtins. */
horizon.utils = {
// Log function which checks for DEBUG and the existence of a console.
log: function (thing_to_log) {
log: function () {
if (horizon.conf.debug && typeof(console) !== "undefined" && typeof(console.log) !== "undefined") {
console.log(thing_to_log);
console.log(arguments);
}
},