code sauce

...

User Friendly Selects in Birt

| Comments

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

1
2
3
4
5
6
<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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<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>

Comments