},
setWindowElementsEvent: function(opts) {
- this.repeaterEl = opts.repeater_id;
+ this.repeaterEl = opts.repeater_id + '_Container';
this.gridEl = opts.grid_id;
this.loadRequest = opts.request_obj;
if (opts.hasOwnProperty('actions_obj')) {
setLoadRequest: function() {
var dataList = [];
- if($(this.gridEl)) {
- dataList = $(this.gridEl).select('tr');
+ var repeater = $(this.repeaterEl);
+ var grid = $(this.gridEl);
+ if(grid) {
+ dataList = grid.select('tr');
this.makeSortable();
- } else if ($(this.repeaterEl + '_Container')) {
- dataList = $(this.repeaterEl + '_Container').select('div.slide-window-element');
+ } else if (repeater) {
+ dataList = repeater.select('div.slide-window-element');
}
var set_callback_parameter = function(element) {
this.configurationObj.openConfigurationWindow(this);
}
}.bind(this);
+ this.setSearch();
dataList.each(function(tr) {
$(tr).observe('click', function(index, clickedEl) {
var target = clickedEl.target || clickedEl.srcElement;
},
setSearch: function() {
- var search_pattern = new RegExp(this.search.value)
- $$('div[id="' + this.windowId + this.elements.containerSuffix + '"] div.' + this.elements.contentItems).each(function(value){
-
- if(search_pattern.match(value.childNodes[2].textContent) == false) {
+ var search_pattern = new RegExp(this.search.value, 'i');
+ var repeater = $(this.repeaterEl);
+ var grid = $(this.gridEl);
+ if (repeater) {
+ repeater.select('div.' + this.elements.contentItems).each(function(value){
+ if(search_pattern.test(value.childNodes[2].textContent) == false) {
value.setStyle({'display' : 'none'});
} else {
value.setStyle({'display' : ''});
}
}.bind(search_pattern));
-
- $$('div[id="' + this.windowId + this.elements.containerSuffix + '"] tr.' + this.elements.contentItems + ', div[id="' + this.windowId + this.elements.containerSuffix + '"] tr.' + this.elements.contentAlternatingItems).each(function(value){
- if(search_pattern.match(value.down('div').innerHTML) == false) {
- value.setStyle({'display' : 'none'});
+ }
+
+ if (grid) {
+ grid.select('tr').each(function(value){
+ var tds = value.select('td');
+ var td;
+ var found = false;
+ for (var i = 0; i < tds.length; i++) {
+ td = tds[i].textContent.trim();
+ if(search_pattern.test(td) == true) {
+ found = true;
+ break;
+ }
+ }
+
+ if(found === true) {
+ value.show();
} else {
- value.setStyle({'display' : ''});
+ value.hide();
}
}.bind(search_pattern));
+ }
},
setElementsCount : function() {
var elements_count = $$('div[id="' + this.windowId + this.elements.containerSuffix + '"] div.' + this.elements.contentItems).length || $$('div[id="' + this.windowId + this.elements.containerSuffix + '"] tr.' + this.elements.contentItems + ', div[id="' + this.windowId + this.elements.containerSuffix + '"] tr.' + this.elements.contentAlternatingItems).length;
return $(this.windowId + this.elements.toolbarSuffix).visible();
},
setActions: function() {
- var table = $(this.window).down('table');
- var checkboxes = table.select('input[name="actions_checkbox"]');
+ var checkboxes = this.getCheckboxes();
checkboxes.each(function(el) {
el.observe('change', function() {
- var is_checked = this.is_any_checked(checkboxes);
+ var is_checked = this.isAnyChecked(checkboxes);
if(is_checked === true && !this.areActionsOpen()) {
this.showActions();
} else if (is_checked === false && this.areActionsOpen()) {
}.bind(this));
}.bind(this));
},
- is_any_checked: function(checkboxes) {
+ isAnyChecked: function(checkboxes) {
var is_checked = false;
checkboxes.each(function(ch) {
if(ch.checked == true) {
return is_checked;
},
+ getCheckboxes: function() {
+ var grid = $(this.gridEl);
+ var checkboxes = [];
+ if (grid) {
+ checkboxes = grid.select('input[name="actions_checkbox"]');
+ }
+ return checkboxes;
+ },
+
+ areCheckboxesChecked: function() {
+ var checkboxes = this.getCheckboxes();
+ return this.isAnyChecked(checkboxes);
+ },
+
markAllChecked: function(check) {
this.checked = [];
- var table = $(this.window).down('table');
- var checkboxes = table.select('input[name="actions_checkbox"]');
+ var checkboxes = this.getCheckboxes();
var containerId;
if(checkboxes.length > 0) {
checkboxes.each(function(ch, index) {