NB Fouda
NB Fouda

Reputation: 1393

Dynamic columns in Primefaces datatable

I want to create a dynamic datatable using Primefaces that reflects user's choice. The user can choose one of the two radio buttons and then the datatable will be shown to the user.

The only difference between two radio buttons is that choosing the second one the datatable will contain an additional column.

Is it possible to create such datatable, using Primefaces and JSF?

Upvotes: 0

Views: 765

Answers (1)

Ondrej Bozek
Ondrej Bozek

Reputation: 11481

Easiest solution would be to set rendered attribute of column depending on radio button selected.

...
<h:column rendered="#{myBean.radioValue}">
...

radio button 1 -> myBean.radioValue=false
radio button 2 -> myBean.radioValue=true

Upvotes: 1

Related Questions