remove category of filter on its removal. also, we define document.getElementsByClassName for IE

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1747 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
j.wollert 14 years ago
parent 2fd0a986f1
commit 080bf0fb5d
  1. 43
      assets/javascripts/reporting.js

@ -60,6 +60,13 @@ function display_category(tr_field) {
}
}
function hide_category(tr_field) {
var label = $(tr_field.getAttribute("data-label"));
if (label !== null) {
label.hide();
}
}
function show_filter(field) {
var field_el = $('tr_' + field);
if (field_el !== null) {
@ -78,7 +85,21 @@ function hide_filter(field) {
field_el.hide();
toggle_filter(field);
operator_changed(field, $("operators_" + field));
if (!occupied_categories()) {
hide_category(field_el);
}
}
}
function occupied_categories() {
var i, hit = false;
filters = document.getElementsByClassName('filter');
for (i = 0; i < filters.length; i++) {
if (filters[i].visible()) {
return hit = true;
}
}
return hit;
}
function disable_select_option(select, field) {
@ -229,3 +250,25 @@ function disable_all_group_bys() {
moveOptions(origin, destination);
});
}
function defineElementGetter() {
if (document.getElementsByClassName == undefined) {
document.getElementsByClassName = function(className)
{
var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
var allElements = document.getElementsByTagName("*");
var results = [];
var element;
for (var i = 0; (element = allElements[i]) != null; i++) {
var elementClass = element.className;
if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
results.push(element);
}
return results;
}
}
}
defineElementGetter();

Loading…
Cancel
Save