Thursday, April 14, 2011

Simple trick to format XPages Checkbox group

If you put display:inline on a table (which XPages generates for a CheckboxGroup), you can style each cell like an inline element.

To make a four column checkbox group (put fourColumnCheckboxGroup as styleClass on the xp:checkBoxGroup), put this in your CSS file:
.fourColumnCheckboxGroup { display: inline; }
.fourColumnCheckboxGroup td { float: left; width: 24%; }

For three columns, use 32% and so on. I use (100 / numberOfColumns) - 1 as that seems to work best cross browser.

Share and enjoy :)

Tuesday, April 5, 2011

Add a custom footer to a ViewPanel column

Open the XPage in source mode. Set the pointer inside <xp:this.facets>. Create a panel, div, output text or whatever with the attribute xp:key="footer", and the content will be showed at the bottom of the column.

<xp:text value="#{viewScope.totalsForSomeColumn}" xp:key="footer" />