Javascript report designer band contains absolute positioned fields which can changed in designer.
html:
<div class='designer-panel-body' style='height:100px'>
<div class='designer-label' style='top:10px'>
Field1
</div>
<div class='designer-label' style='top:60px; left:20px'>
Field2
</div>
</div>
CSS:
.designer-panel-body {
border: solid 1px;
}
.designer-label {
position: absolute
}
Javascript:
$(".designer-panel-body").resizable({
start: function(event, ui) {
$(this).resizable("option", "minHeight", 80)
},
handles: "s"
});
Fiddle: https://jsfiddle.net/xk98f2rq/
Band height can also changed by mouse. How to set minimal height so that band height cannot made shorter than last field top position ?
Code in sample uses hard-code value 80 for this. If fields are changed in runtime, for example Field2 is deleted, this value is smaller, so that panel can resized to top of Field1.
How to calculate minHeight is start method? Is it reasonable/how to refactor this code so that it uses plain javascript, without jquery and jquery ui?
By using
position: absolutethe parent div does not adapt its height to the height of the children. A solution is to compute the height of the children (this includesouterHeightplusoffset) in a functionget_height()and apply the computed height to the container.When removing
.designer-labelitems (by clicking on them) theminHeightof the resizable element is adapted.