user friendly selects in birt

Posted by gjergj.sheldija on August 29, 2017

a very straightforward post on how to add the chosen plugin to select boxes in birt. first download the chosen plugin from https://harvesthq.github.io/chosen/ and extract the files in webcontent/birt/js. then edit webcontent/birt/pages/layout/FramesetFramgment.jsp and add

<link rel="stylesheet" href="birt/js/chosen.min.css">
<script src="birt/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="birt/js/chosen.jquery.min.js" type="text/javascript"></script>
<script>
var $jQuery = jQuery.noConflict();
</script>

and webcontent/birt/pages/parameter/ComboBoxParameterFragment.jsp and add the following code at the end of the file

<script>
var setInt;
$jQuery("#<%= encodedParameterName + "_selection"%>")
	.chosen({
		disable_search_threshold: 10, 
		width: "400px"
	})
	.change(function() {
		birtParameterDialog.__refresh_cascade_select($("<%= encodedParameterName + "_selection"%>"));
		window.setTimeout(function() {
			$jQuery('.birtviewer_parameter_dialog_Select').trigger('chosen:updated');
		}, 100);
});
</script>