0

I wanna create a table where I should hide some columns. Whenever I click on an arrow or some button The hidden columns should be display along with original columns in that table. For example, I have 20 columns, I don't need show all the columns at the staring point of view. Suppose I want to display 5 columns in UI, renaming 15 should be hidden. Where can I put some arrow on right corner(in header line) of table to extend the table with remaining columns.

Is it possible with JSF with rich-faces or anything else.

Thank you in advance.

sankar
  • 181
  • 1
  • 2
  • 12

2 Answers2

0

Take a look on this example on primefaces labs. It allows to dynamically add columns to a datatable. I am sure you can tweak it to get the behaviour you are looking for.

Eugenio Cuevas
  • 10,858
  • 3
  • 29
  • 51
0

Use a <rich:dataTable. Set the rendered property of the columns which should be initially hidden by using a boolean property in your class.

<rich:dataTable value="" var="v" id="tbl">
     <rich:column>Always visible column 1</rich:column>
     <rich:column rendered="#{del.renderColumn}">Visible on demand</rich:column>
     <rich:column>Always visible column 2</rich:column>
     <rich:column>Always visible column 3</rich:column>
</rich:dataTable>

Use an <a4j:commandButton and set the property renderColumn as true at button action and reRender the table.

<a4j:commandButton value="Show" action="#{del.renderHiddenColumn()}" reRender="tbl"/>

prageeth
  • 7,159
  • 7
  • 44
  • 72