Oh! I got it now. Thanks Rafa :-)

On Sun, 2007-11-18 at 23:24 +0100, Rafa Pérez wrote:
> Hi,
> 
> What does getContactMethod() returns? You may add to the RowKeySet the
> index of the row, not the object it contains.
> 
> HTH,
> 
> - - Rafa
> 
> 
> 
> On Nov 17, 2007 5:01 AM, Curtney Jacobs < [EMAIL PROTECTED]>
> wrote:
>         Hi, 
>         
>         I tried option  'A' however, the radio button in the table is
>         still not
>         selected when the page is rendered.
>         
>         I tried calling:
>         
>         tableSelection.invert(getContactMethod());
>         or
>         tableSelection.add (getContactMethod());
>         
>         however, it does not work. By debuging, I can see that the
>         object is in the
>         set, however nothing is selected in the UI.
>         
>         
>         On Friday 16 November 2007 01:34, Rafa Pérez wrote: 
>         > Hi,
>         >
>         > You have at least two options:
>         >
>         > a) Link the table's selection state to the controller.
>         > @Name("controlador")
>         > public class Controller {
>         > ..
>         >
>         > RowKeySet seleccion = new RowKeySetImpl;
>         > //with its get & set
>         > ..
>         > }
>         >
>         > and at you jsp:
>         >
>         > <tr:table rowSelection="single"
>         selectedRowKeys="#{ controlador.seleccion}">
>         > ...
>         > </tr:table>
>         >
>         > By addign or deleting an entry in this property, you are
>         selecting or
>         > unselecting the proper row in the table's CollectionModel.
>         If you have 
>         > defined an action on pages.xml, you may perform this
>         operation in that
>         > method. Or if you only want the preselection to be made, you
>         may modify the
>         > selection state in your @Create.
>         >
>         > b) You may binding your table to a property in your bean.
>         Thus, if you have 
>         > a class like
>         >
>         > @Name("controlador")
>         > public class Controller {
>         > ..
>         >
>         > CoreTable tabla;
>         > //with its get & set
>         > ..
>         > }
>         >
>         > you just need to set 
>         >
>         > <tr:table binding="#{controlador.tabla}">
>         > ...
>         > </tr:table>
>         >
>         > This way, you can access the table and handle its selection.
>         >
>         > On Nov 16, 2007 2:39 AM, Curtney Jacobs <
>         [EMAIL PROTECTED]> wrote:
>         > > Greetings everyone!
>         > >
>         > > I have a table (with rowSelection="single") that is pre
>         -populated with 
>         > > data
>         > > and I would like a default row to be selected. How can I
>         do that?
>         > >
>         > > I am using seam to inject the table component
>         > >
>         > >  @In
>         (value="#{uiComponent['postalAddressForm:postalAddressTable']}", 
>         > > required=false)
>         > >    private UIComponent uiComponent;
>         > >
>         > > however,  when I try to do the following I am getting a
>         > > NullPointerException:
>         > > UIXTable table = (UIXTable)uiComponent; 
>         > >
>          table.setRowKey(contactMethod());
>         > >
>         > > My thinking is I get this error because the table has not
>         been rendered
>         > > yet,
>         > > thus injecting the component produces the exception. 
>         > >
>         > >
>         > > All suggestions are welcomed.
>         > >
>         > > Curtney
>         
> 

Reply via email to