Skip to content

Commit

Permalink
Merge pull request molgenis#1549 from jjettenn/master
Browse files Browse the repository at this point in the history
Complex filters: Show complex filter operator only when more then one input fields exist
  • Loading branch information
dennishendriksen committed May 22, 2014
2 parents 552d2e1 + ead7496 commit bdec961
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@
var label = attribute.label || attribute.name;
elements.append($('<label class="control-label" data-placement="right" data-title="' + attribute.description + '">' + label + '</label>').tooltip());
var row = $('<div class="controls controls-row">');
$('.controls.controls-row', elements).parent().append(row.append($('<button class="btn" type="button"><i class="icon-trash icon-plus"></i></button>').click(function(){
$('.controls.controls-row', elements).parent().append(row.append($('<button class="btn" type="button"><i class="icon-plus"></i></button>').click(function(){
addComplexFilterControlsElementsToContainer(container, attribute, operator, undefined, addLabel, true);
if(!$('.complexFilter.operator', container).length){
createComplexFilterSelectOperator(operator, row);
}
})));

createComplexFilterSelectOperator(operator, row);
}

return container.append(elements);
Expand All @@ -213,13 +214,16 @@
/**
* @memberOf molgenis.dataexplorer
*/
function addRemoveButton(container){
$('.controls.controls-row', container)
function addRemoveButton(elements){
$('.controls.controls-row', elements)
.parent().append($('<div class="controls controls-row">').append($('<button class="btn" type="button"><i class="icon-trash"></i></button>').click(function(){
$(this).parent().parent().remove();
if($('.icon-trash', elements.parent()).length === 1){
$('.bootstrap-switch', elements.parent()).remove();
}
$(this).parent().parent().remove();
})));
return container;

return elements;
}


Expand Down

0 comments on commit bdec961

Please sign in to comment.