Title: [Trinidad] how to add default selection for Table
Thomas,

Like you said, you can EL-bind selectedRowKeys. After you instantiate RowKeySetImpl, you can call add() that takes a row key.
Since you are using java.util.List as your table's value, the CollectionModel wrapper will use a stringified version of the index as a key.
So String.valueOf(index) will be a key for the given index.

Regards,
Max Starets

[EMAIL PROTECTED] wrote:

Hi all,
Im facing a problem with a tr:table that uses rowSelection="single". Depending on the displayed data, one Row should be selected as default. The selectedRowKeys-attribute takes an EL-_expression_ that points to a RowKeySet. Since there aint no way to simply add a row-index to the keyset, Im unsure how to tell the table wich row to select as default.

My table is defined like this:
<tr:table value="#{myBean.billingAdresses}" var="address" rowSelection="single" binding="#{myBean.addressTable}" >

The billingAddresses method in the BackingBean returns a list of BillingAddress-Objects. One of these objects has a boolean attribute "selected" set to true. The row dsiplaying this object should be preselected.

I tried to find some help on the web but found only one solution that was highly dependent on Seam.

Thanks in advance,
Tom


Thomas Asel
Diplom Informatiker (FH)
Selbständiger Softwareentwickler
im Auftrag der 24/7 IT-Services GmbH

== == == == == == == == == == == ==
www.thomas-asel.de
J2EE und Contentmanagement-Lösungen
L13,7 68161 Mannheim
Tel.: +49 (0) 621 / 386 448 3
Mobil: +49(0) 176 / 219 284 26
USt-IdNr.: DE248123620


Reply via email to