How to Make Input Control Labels Collapsible in Jasper Server Using Optional JSP
We need to create our own JSP
Example : lets say Optional.jsp is our jsp which should be kept under location in your jasperserver
jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserverpro\WEBINF\jsp\modules\inputControls
In this path you can see DefaultParametersForm.jsp which having empty template-
<%–Include templates–%>
<ul class=”list inputControls” id=”inputControlsContainer”></ul>
<%– input controls container –%>
<jsp:include page=”InputControlTemplates.jsp” />
–so you can add the same in you new jsp and define your own lo
We need to add InputControlTemplates.jsp in this current jsp page so that we can handle any type of Input controls like silgleselect, multiselect, multiselect checkbox all the types of inputcontrols are handled in this jsp using mustache template.
<%–Include templates–%>
Step 1: We wrote jQuery in that we have added 2 images one for slide down and one for slide up and the images are added in the path apache-tomcat\webapps\jasperserver-pro.
Step 2: We have appended my both images in the inputControlsContainer id and span.wrap class which is defined in every input control class you can use according to your requirement.
Step 3: Now we have created a function when my label is open then added the logic to slide down and then we have to hide my open image and show the close image when my label is opened.
Step 4: Here we are hiding ui_icon that is used for draggable the input control label.
Step5 :In the same fashion we have written a function for close icon.
jQuery(document).ready(function() {
jQuery(“#inputControlsContainer span.wrap”).append(“ “);
jQuery(“#inputControlsContainer span.wrap”).append(“ “);
jQuery(“#inputControlsContainer span.wrap #close”).hide();
jQuery(“#inputControlsContainer span.wrap #open”).css(“float”,”right”);
jQuery(“#inputControlsContainer span.wrap #close”).css(“float”,”right”);
jQuery(‘body’).on(“click”, “span.wrap #open”,function(){
jQuery(this).parent().next().slideDown();
jQuery(this).toggle();
jQuery(this).parent().parent().find(“#close”).show();
jQuery(this).parent().parent().find(“span.ui-icon”).show();
}
);
jQuery(‘body’).on(“click”, “span.wrap #close”,function(){
jQuery(this).parent().next().slideUp();
jQuery(this).toggle();
jQuery(this).parent().parent().find(“#open”).show();
jQuery(this).parent().parent().find(“span.ui-icon”).hide();
}
);
Thanks & Regards.
A.Prasanth Kumar.
Best Open Source Business Intelligence Software Helical Insight is Here