You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rafa Pérez <ra...@gmail.com> on 2008/06/12 19:49:05 UTC
Re: [Trinidad] Default selection for Table
Hi Sivakumar,
Once you have a RowKeySet object you just need to add the index of the row
you want to be selected. For example, you can do:
RowKeySet seleccion = new RowKeySetImpl();
seleccion.add(0);
for the first row to be selected.
HTH,
-- Rafa
PD: This should be sent to Trinidad's mailing list, as it could be useful to
other people.
On Thu, Jun 12, 2008 at 5:48 PM, Sivakumar2 D <si...@tcs.com> wrote:
> Rafa Perez, Hi
>
> Am Sivakumar, I found your Answers from the below site which helped me a
> lot.
>
> Could you please suggest how to set the value for the "RowKeySet seleccion
> = new RowKeySetImpl;".
>
> I need to set the first Radio button as selected in the table by defauld.
> What should be the value for the seleccion here?
>
> Reply me at (*sivakumar2.d@tcs.com*).
>
> Many thanks in advance..!
>
> Regards,
>
> Siva
>
> *Re: [Trinidad] Default selection for Table*
>
> Rafa Pérez
>
> Mon, 19 Nov 2007 13:32:08 -0800
>
> You are welcome! ;)
>
> On Nov 19, 2007 7:24 AM, Curtney Jacobs <[EMAIL PROTECTED]> wrote:
>
> > 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
> > >
> > >
> >
> >
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
>
Re: [Trinidad] Default selection for Table
Posted by Richard Yee <ri...@gmail.com>.
Can you send your java and jsp code so we can see what exactly is not
working? I have been able to select the first entry in a table without any
problems.
-R
On Fri, Jun 13, 2008 at 6:13 AM, Sivakumar2 D <si...@tcs.com> wrote:
>
> Rafa Perez, Hi
>
> Still I'am having some problem with this, the value is not selected by
> default.
>
> selection.add(0);
>
> While displaying the controlador.seleccion by outputText the value
> displayed as '[0]'. But the selectedRowKeys not reflecting any changes.
>
> Expecting your suggestions...
>
> Regards,
> Siva
>
>
>
>
>
> Hi Sivakumar,
>
> Once you have a RowKeySet object you just need to add the index of the row
> you want to be selected. For example, you can do:
>
> RowKeySet seleccion = new RowKeySetImpl();
> seleccion.add(0);
>
> for the first row to be selected.
>
> HTH,
>
> -- Rafa
>
> PD: This should be sent to Trinidad's mailing list, as it could be useful
> to other people.
>
>
> Rafa Perez, Hi
>
> Am Sivakumar, I found your Answers from the below site which helped me a
> lot.
>
> Could you please suggest how to set the value for the "RowKeySet seleccion
> = new RowKeySetImpl;".
>
> I need to set the first Radio button as selected in the table by defauld.
> What should be the value for the seleccion here?
>
> Many thanks in advance..!
>
> Regards,
>
> Siva
>
> *Re: [Trinidad] Default selection for Table*
>
> Rafa Pérez
>
> Mon, 19 Nov 2007 13:32:08 -0800
>
> You are welcome! ;)
>
> On Nov 19, 2007 7:24 AM, Curtney Jacobs <[EMAIL PROTECTED]> wrote:
>
> > 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
> > >
> > >
> >
> >
>
>
> ForwardSourceID:NT0000BDD2
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
>
Re: [Trinidad] Default selection for Table
Posted by Sivakumar2 D <si...@tcs.com>.
Rafa, Hi
Many Thanks...!
I got the default selected radio button. The small change is:
seleccio.add("0");
Now everything is fine, thanks for the valuable guidance.
Regards,
Siva
Hi Sivakumar,
Once you have a RowKeySet object you just need to add the index of the row
you want to be selected. For example, you can do:
RowKeySet seleccion = new RowKeySetImpl();
seleccion.add(0);
for the first row to be selected.
HTH,
-- Rafa
PD: This should be sent to Trinidad's mailing list, as it could be useful
to other people.
On Thu, Jun 12, 2008 at 5:48 PM, Sivakumar2 D <si...@tcs.com>
wrote:
Rafa Perez, Hi
Am Sivakumar, I found your Answers from the below site which helped me a
lot.
Could you please suggest how to set the value for the "RowKeySet seleccion
= new RowKeySetImpl;".
I need to set the first Radio button as selected in the table by defauld.
What should be the value for the seleccion here?
Reply me at (sivakumar2.d@tcs.com).
Many thanks in advance..!
Regards,
Siva
Re: [Trinidad] Default selection for Table
Rafa Pérez
Mon, 19 Nov 2007 13:32:08 -0800
You are welcome! ;)
On Nov 19, 2007 7:24 AM, Curtney Jacobs <[EMAIL PROTECTED]> wrote:
> 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
> >
> >
>
>
ForwardSourceID:NT0000BDD2
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
Re: [Trinidad] Default selection for Table
Posted by Sivakumar2 D <si...@tcs.com>.
Rafa Perez, Hi
Still I'am having some problem with this, the value is not selected by
default.
selection.add(0);
While displaying the controlador.seleccion by outputText the value
displayed as '[0]'. But the selectedRowKeys not reflecting any changes.
Expecting your suggestions...
Regards,
Siva
Hi Sivakumar,
Once you have a RowKeySet object you just need to add the index of the row
you want to be selected. For example, you can do:
RowKeySet seleccion = new RowKeySetImpl();
seleccion.add(0);
for the first row to be selected.
HTH,
-- Rafa
PD: This should be sent to Trinidad's mailing list, as it could be useful
to other people.
Rafa Perez, Hi
Am Sivakumar, I found your Answers from the below site which helped me a
lot.
Could you please suggest how to set the value for the "RowKeySet seleccion
= new RowKeySetImpl;".
I need to set the first Radio button as selected in the table by defauld.
What should be the value for the seleccion here?
Many thanks in advance..!
Regards,
Siva
Re: [Trinidad] Default selection for Table
Rafa Pérez
Mon, 19 Nov 2007 13:32:08 -0800
You are welcome! ;)
On Nov 19, 2007 7:24 AM, Curtney Jacobs <[EMAIL PROTECTED]> wrote:
> 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
> >
> >
>
>
ForwardSourceID:NT0000BDD2
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you