checkboxjasper-reportsxmltable

JRXML - Display a checkbox in a table


I can't manage to display a checkbox in a table in jrxml.

Here is a sample of my code:

<detail>
    <band height="45" splitType="Stretch">
        <textField isBlankWhenNull="true">
            <reportElement style="MyCustomStyle" stretchType="RelativeToTallestObject" x="650" y="0" width="80" height="35"/>
            <textElement textAlignment="Center"/>
            <textFieldExpression class="java.lang.Boolean"><![CDATA[$F{myBooleanVariable}]]>
            </textFieldExpression>
        </textField>
    </band>
</detail>

The column just displays true or false. I supposed that specifying class="java.lang.Boolean" in the textFieldExpression element would convert the value to a checkbox but apparently, I need more than that.

Any idea of what I'm doing wrong?


Solution

  • Al right so apparently it's not possible to add a checkbox in a table with that language !

    So now I just display YES/NO:

    <textFieldExpression class="java.lang.String"><![CDATA[$F{myBooleanVariable}?"YES":"NO"]]></textFieldExpression>
    

    That's the best I could find !