It's similar but not quite the same.
The added columns attributes defines the number of columns the renderer is
going to use. So this is fixed while the number of rows depends on the
number of selectItem objects inside.
Setting layout=pageDirection and columns=3 gives:
[A] [E] [I]
[B] [F] [J]
[C] [G]
[D] [H]
Setting the layout=lineDirection with columns=3 gives:
[A] [B] [C]
[D] [E] [F]
[G] [H] [I]
[J]
Ignoring the columns attribute or setting it to 0 produces the default
behaviour.
Greetings
Jan
On Fri, 09 Sep 2005 17:37:39 +0200, Ken Weiner <[EMAIL PROTECTED]> wrote:
Thanks. Does your columns attribute work with page direction and line
direction? I ended up extending the component as well to handle a
"width" of
checkboxes in both directions. I'll take a look at your code next week to
see if it is similar and if I can enhance it with both drawing
directions if
it isn't already done.
On 9/7/05, Jan Bols <[EMAIL PROTECTED]> wrote:
I had the same problem and ended up extending the HtmlSelectManyCheckbox
component. I added a "columns" attribute where you can specify the
number
of columns you want the selectManyCheckbox to use. Like this:
<cc:selectManyCheckbox
layout="pageDirection"
columns="2">
<f:selectItems value="#{mySelectItems}"/>
</cc:selectManyCheckbox>
You can find the sourcecode on http://sourceforge.net/projects/jsf-comp
but there's also a jar that you can add to WEB-INF/lib directory. The
jar
file is found on http://www.ivpv.ugent.be/~jan/myfacessandbox.jar. The
jar
file is for use with the nightly version (so not the 1.0.9 version) of
myfaces dating from 2005-08-15 but with a bit of luck it should also
work
with the current nightly version of myfaces.
You can find a working example of this on
https://www.ivpv.ugent.be/contact/new.faces?lang=en . Also on
http://www.ivpv.ugent.be/~jan/selectTest.jsp you can find a jsf file to
get you started...
Hope this helps.
Jan
On Thu, 01 Sep 2005 22:19:36 +0200, Ken Weiner <[EMAIL PROTECTED]>
wrote:
> I need to find a way to render the checkboxes in
HtmlSelectManyCheckbox
> in a
> format other than a single horizontal or vertical row. My first
thought
> was
> to extend HtmlSelectManyCheckbox and make a new attribute called
"width"
> and
> use this in conjunction with the "layout" attribute as follows:
>
> <h:selectManyCheckbox value="#{backingBean.someArray}"
> layout="pageDirection" width="3">
> <f:selectItems value="#{backingBean.someSelectItems}"/>
> </h:selectManyCheckbox>
>
> would produce
>
> [x] [x] [x]
> [x] [x] [x]
> [x] [x] [x]
> [x] [x] [x]
> [x] [x] [x]
> [x] [x] [x]
> etc.
>
> and
>
> <h:selectManyCheckbox value="#{backingBean.someArray}"
> layout="lineDirection" width="3">
> <f:selectItems value="#{backingBean.someSelectItems}"/>
> </h:selectManyCheckbox>
>
> would produce
>
> [x] [x] [x] [x] [x] [x] etc.
> [x] [x] [x] [x] [x] [x]
> [x] [x] [x] [x] [x] [x]
>
> Is there better way to accomplish this? Should I be thinking about
using
> SelectItemGroups? I'm ultimately trying to create a 2 X 2 set of
> checkboxes.
> Thanks!
>
> -Ken