myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rafa Pérez" <raja...@gmail.com>
Subject Re: [Trinidad] Default selection for Table
Date Sun, 18 Nov 2007 22:24:10 GMT
Hi,

What does getContactMethod() returns? You may add to the RowKeySet the inde=
x
of the row, not the object it contains.

HTH,

- - Rafa



On Nov 17, 2007 5:01 AM, Curtney Jacobs <c.curtneyjacobs@comcast.net> 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=E9rez 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 =3D new RowKeySetImpl;
> > //with its get & set
> > ..
> > }
> >
> > and at you jsp:
> >
> > <tr:table rowSelection=3D"single" selectedRowKeys=3D"#{controlador.sele=
ccion
> }">
> > ...
> > </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=3D"#{controlador.tabla}">
> > ...
> > </tr:table>
> >
> > This way, you can access the table and handle its selection.
> >
> > On Nov 16, 2007 2:39 AM, Curtney Jacobs <c.curtneyjacobs@comcast.net>
> wrote:
> > > Greetings everyone!
> > >
> > > I have a table (with rowSelection=3D"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=3D"#{uiComponent['postalAddressForm:postalAddressTable']}=
",
> > > required=3Dfalse)
> > >    private UIComponent uiComponent;
> > >
> > > however,  when I try to do the following I am getting a
> > > NullPointerException:
> > > UIXTable table =3D (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
>

Mime
View raw message