You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by kevin_zhai <ja...@gmail.com> on 2006/10/31 13:29:02 UTC

How to dynamically show different components for each row in a table

I have a  Table that has a column containing buttons for operations on each
row. Each row may have different operations applicable to it, so the buttons
for each row need to be determined dynamically based on the contents of row.

I have seen code to dynamically create buttons, but what I would like to
know is how to do this on a per-row basis, so that row 1 would might have 1
button, row 2 would have 3 buttons and so on. I would like to avoid the
solution of creating all of the possible types of buttons and hiding the
ones that do not apply to the current row.
-- 
View this message in context: http://www.nabble.com/How-to-dynamically-show-different-components-for-each-row-in-a-table-tf2545575.html#a7093117
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: How to dynamically show different components for each row in a table

Posted by Sean Schofield <se...@gmail.com>.
This is probably best discussed on the users list.  The dev list is
for discussion of new components and general project coordination.

Sean

On 10/31/06, kevin_zhai <ja...@gmail.com> wrote:
>
> My table maybe each row(column) need different UI
> component(radio,button,checkbox,textbox,etc),
> so,use rendered attribute,it's not enough,
> I need ,dynamically creat my table depending data type from select from
> database data,
> btw,thanks you advise
>
> --
> View this message in context: http://www.nabble.com/How-to-dynamically-show-different-components-for-each-row-in-a-table-tf2545575.html#a7095132
> Sent from the My Faces - Dev mailing list archive at Nabble.com.
>
>

Re: How to dynamically show different components for each row in a table

Posted by kevin_zhai <ja...@gmail.com>.
My table maybe each row(column) need different UI
component(radio,button,checkbox,textbox,etc),
so,use rendered attribute,it's not enough,
I need ,dynamically creat my table depending data type from select from
database data,
btw,thanks you advise

-- 
View this message in context: http://www.nabble.com/How-to-dynamically-show-different-components-for-each-row-in-a-table-tf2545575.html#a7095132
Sent from the My Faces - Dev mailing list archive at Nabble.com.


Re: How to dynamically show different components for each row in a table

Posted by Nick77 <ni...@gmail.com>.
I had a similar problem where I wanted to display different UI input
components depending on the type of data in the row (ie String, Date, Double
etc). I found the easiest way to do this was to add ALL the options and
select which is displayed using the rendered attribute. I also did not want
to just 'hide' the ones that did not apply, however as far as I know the
rendered attribute doesn't just hide the component, it doesn't even create
it. I needed this behaviour otherwise I would have got runtime errors eg
trying to call a String method on a Double.
Hope this helps,
Nick

kevin_zhai wrote:
> 
> I have a  Table that has a column containing buttons for operations on
> each row. Each row may have different operations applicable to it, so the
> buttons for each row need to be determined dynamically based on the
> contents of row.
> 
> I have seen code to dynamically create buttons, but what I would like to
> know is how to do this on a per-row basis, so that row 1 would might have
> 1 button, row 2 would have 3 buttons and so on. I would like to avoid the
> solution of creating all of the possible types of buttons and hiding the
> ones that do not apply to the current row.
> 

-- 
View this message in context: http://www.nabble.com/How-to-dynamically-show-different-components-for-each-row-in-a-table-tf2545575.html#a7094611
Sent from the My Faces - Dev mailing list archive at Nabble.com.