Search code examples
xpageslotus-noteslotus-dominolotusxpages-extlib

Xpages Extlib dataView control sets "display:none;" style when column has empty value


I have a xpage with Extension Library DataView control. I have defined several extra columns there.

<xe:dataView id="dataView1"         
    <xe:this.data>
        <xp:dominoView var="vMyView" />
    </xe:this.data>

    <xe:this.summaryColumn>
        <xe:viewSummaryColumn columnName="$DateFrom"
            columnTitle="Date From">
        </xe:viewSummaryColumn>
    </xe:this.summaryColumn>

    <xe:this.extraColumns>
        <xe:viewExtraColumn columnName="$DateTo"
            styleClass="hidden-xs" headerStyleClass="hidden-xs" columnTitle="Date To"
            style="hidden-xs">
        </xe:viewExtraColumn>
        <xe:viewExtraColumn columnName="$Information"
            columnTitle="Information">
        </xe:viewExtraColumn>           
    </xe:this.extraColumns>
</xe:dataView>

My view data source contains same cells where information is empty. Those cells are rendered with style="display:none;".

How can I avoid this attribute and display those empty cells? I'd like not to change my view to fill empty cells with i.e. "-" char


Solution

  • An empty column value gets rendered with style="display:none;":

    enter image description here

    You can avoid this if you add a custom converter to your column definition and replace an empty value by a space:

    <xe:viewExtraColumn columnName="$Information"
        columnTitle="Information">
        <xe:this.converter>
            <xp:customConverter>
                <xp:this.getAsString><![CDATA[#{javascript:value == "" ? " " : value}]]></xp:this.getAsString>
                <xp:this.getAsObject><![CDATA[#{javascript:value}]]></xp:this.getAsObject>
            </xp:customConverter>
        </xe:this.converter>
    </xe:viewExtraColumn>
    

    It gets rendered to a "normal" grid cell without display:none then:

    enter image description here

    The code for getAsObject doesn't matter as long as the cell is not editable. So it's OK to just leave the value as it is.