/*global Icinga:false, document: false, define:false require:false base_url:false console:false */
define(['jquery','logging'], function($,log) {
"use strict";
return function() {
this.count = 10;
this.offset = 0;
this.searchable = false;
var construct = function(el) {
this.el = $(el);
this.count = this.el.attr("count") || this.count;
this.searchable = this.el.attr("searchable") || false;
this.render();
};
var renderQuicksearch = (function() {
this.input = $("");
$('.expand-title',this.el.parents('.expandable').first())
.append(this.input)
.append($(""));
this.input.on("keyup",this.updateVisible.bind(this));
}).bind(this);
this.updateVisible = function() {
var filter = this.input.val();
$("tbody tr",this.el).hide();
$("td",this.el).each(function() {
if($(this).text().match(filter)) {
$(this).parent("tbody tr").show();
}
});
};
this.render = function() {
renderQuicksearch();
};
construct.apply(this,arguments);
};
});