Eldar7 Posted March 21, 2017 Share Posted March 21, 2017 Here already exist such quastion, but it was 6 years ago.Is there any changes in new version of Jasper Library / Jasper Studio?May be now it is possible to keeping the same size for the whole table after hide some columns? Link to comment Share on other sites More sharing options...
Eldar7 Posted March 21, 2017 Author Share Posted March 21, 2017 Is there already such feature request? Link to comment Share on other sites More sharing options...
sadakar Posted March 21, 2017 Share Posted March 21, 2017 http://community.jaspersoft.com/blog/tip-table-component-columns-hiding-based-date-parameter-jasper-reports-dates-comparision-jasperSee this. It could of any help : Link to comment Share on other sites More sharing options...
reportdev Posted March 21, 2017 Share Posted March 21, 2017 check this jrxml.Check the print when expression on the CUSTOMERID column in the table.If you pass All to the parameter, it prints all the 3 columns. if anything else is passed, it will hide the CUSTOMERID column.<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 --><!-- 2017-03-21T09:08:58 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Error" uuid="9f00c1c7-09ad-4cdb-a26c-48d2f2038207"> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table 1_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table 1_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="Dataset1" uuid="276df825-0b12-4d93-ad31-8d4eb16741cd"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/> <parameter name="Param" class="java.lang.String"> <defaultValueExpression><![CDATA["All"]]></defaultValueExpression> </parameter> <queryString> <![CDATA[select * from orders]]> </queryString> <field name="ORDERID" class="java.lang.Integer"/> <field name="CUSTOMERID" class="java.lang.String"/> <field name="EMPLOYEEID" class="java.lang.Integer"/> </subDataset> <parameter name="Param" class="java.lang.String"> <defaultValueExpression><![CDATA["All"]]></defaultValueExpression> </parameter> <queryString> <![CDATA[select * from orders]]> </queryString> <field name="ORDERID" class="java.lang.Integer"/> <field name="CUSTOMERID" class="java.lang.String"/> <field name="EMPLOYEEID" class="java.lang.Integer"/> <field name="ORDERDATE" class="java.sql.Timestamp"/> <field name="REQUIREDDATE" class="java.sql.Timestamp"/> <field name="SHIPPEDDATE" class="java.sql.Timestamp"/> <field name="SHIPVIA" class="java.lang.Integer"/> <field name="FREIGHT" class="java.math.BigDecimal"/> <field name="SHIPNAME" class="java.lang.String"/> <field name="SHIPADDRESS" class="java.lang.String"/> <field name="SHIPCITY" class="java.lang.String"/> <field name="SHIPREGION" class="java.lang.String"/> <field name="SHIPPOSTALCODE" class="java.lang.String"/> <field name="SHIPCOUNTRY" class="java.lang.String"/> <background> <band splitType="Stretch"/> </background> <summary> <band height="60"> <componentElement> <reportElement x="0" y="0" width="555" height="60" uuid="6a587605-24fc-463c-b0d2-951d1cf79c69"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> </reportElement> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="Dataset1" uuid="4e2bf956-45bb-4835-b561-9792d813d585"> <datasetParameter name="Param"> <datasetParameterExpression><![CDATA[$P{Param}]]></datasetParameterExpression> </datasetParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> </datasetRun> <jr:column width="180" uuid="136cfb9c-9a82-433d-b657-c07594d897b7"> <property name="com.jaspersoft.studio.unit.width" value="pixel"/> <jr:columnHeader style="Table 1_CH" height="30"> <property name="com.jaspersoft.studio.unit.width" value="px"/> <staticText> <reportElement x="0" y="0" width="180" height="30" uuid="65809bae-ceee-459d-99b5-81031dbd6695"/> <text><![CDATA[ORDERID]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table 1_TD" height="30"> <textField> <reportElement x="0" y="0" width="180" height="30" uuid="79b6944c-0460-4da3-88ba-11ebdfbaed90"/> <textFieldExpression><![CDATA[$F{ORDERID}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="200" uuid="48fccd5c-4ba2-477e-86d2-581754ca8df0"> <property name="com.jaspersoft.studio.unit.width" value="pixel"/> <printWhenExpression><![CDATA[$P{Param}.equals("All") == true]]></printWhenExpression> <jr:columnHeader style="Table 1_CH" height="30"> <property name="com.jaspersoft.studio.unit.width" value="px"/> <staticText> <reportElement x="0" y="0" width="200" height="30" uuid="6ca7facf-140e-43e7-875d-c7138fcf488c"/> <text><![CDATA[CUSTOMERID]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table 1_TD" height="30"> <textField> <reportElement x="0" y="0" width="200" height="30" uuid="4df4059c-5430-44ba-beed-7c5878c6d426"/> <textFieldExpression><![CDATA[$F{CUSTOMERID}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="170" uuid="07332bb7-ff68-430a-98ed-3a35025436cb"> <property name="com.jaspersoft.studio.unit.width" value="pixel"/> <jr:columnHeader style="Table 1_CH" height="30"> <property name="com.jaspersoft.studio.unit.width" value="px"/> <staticText> <reportElement x="0" y="0" width="170" height="30" uuid="72125348-ce1b-44e7-9977-dbcff95a978e"/> <text><![CDATA[EMPLOYEEID]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table 1_TD" height="30"> <textField> <reportElement x="0" y="0" width="170" height="30" uuid="c49e8e00-ba67-4df2-8808-e0290460d643"/> <textFieldExpression><![CDATA[$F{EMPLOYEEID}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </summary></jasperReport>[/code] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now