js/events: initialize only existing search field

Formlerly JS failed on layouts without menu, should be fixed now.
This commit is contained in:
Thomas Gelf 2014-05-20 21:55:32 +00:00
parent d155c7a3fc
commit 194914917a
1 changed files with 6 additions and 5 deletions

View File

@ -29,11 +29,6 @@
this.applyHandlers($('#layout'));
this.icinga.ui.prepareContainers();
this.icinga.ui.prepareMultiselectTables($(document));
// Remember initial search field value if any
if ($('#menu input.search').val().length) {
this.searchValue = $('#menu input.search').val();
}
},
// TODO: What's this?
@ -81,6 +76,12 @@
// replace all sparklines
$('span.sparkline', el).sparkline('html', { enableTagOptions: true });
var searchField = $('#menu input.search', el);
// Remember initial search field value if any
if (searchField.length && searchField.val().length) {
this.searchValue = searchField.val();
}
},
/**