EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Ellipsis on March 14, 2013, 12:00:58 PM



Title: fit combo, combobox or combogrid to parent div
Post by: Ellipsis on March 14, 2013, 12:00:58 PM
Is it possible to auto fit the input element (selectbox) to the parent div?

The input elements we use have no label and are positioned in a small heigh sidebar.
We tried some methods to set the width of the combogrids after load, by getting the parent innerwidth. But using standard easyui functionality would be cleaner I asume.


Title: Re: fit combo, combobox or combogrid to parent div
Post by: stworthy on March 14, 2013, 06:12:20 PM
The searchbox is not the container component, it has not 'fit' property. The only way to fit a searchbox to its parent div container is to recreate it with 'width' and 'height' properties or call 'resize' method to resize it after created.

Code:
	<div style="width:200px;height:30px;border:1px solid #ccc">
<input id="sb" data-options="prompt:'Please Input Value'"></input>
</div>
<script>
$(function(){
var p = $('#sb').parent();
$('#sb').searchbox({
width: p.width(),
height: p.height()
});
});
</script>