8 Replies Latest reply on May 21, 2011 9:12 AM by Ilya Shaikovsky

    Dynamic columns visibility

    vali_iva Newbie

      Hi, I'm trying to toogle the visibility of column from an extendedDataTable with a checkbox.

      When I check the box, the table gets reRendered, the value in bean is changed but the column does't dis/appear.


      I can't figgured it aout what is wrong.


      Here is the code snippet:



      <rich:extendedDataTable id="indexes" value="#{asetsScreener.indexes}" 
                     var="index"  height="400px" width="900px"
                     title="Indexes" selectionMode="none">
           <rich:column width="40px">
           <a4j:facet name="header"> Index </a4j:facet>
           <h:outputText value="#{index.indicator}"/>
           <rich:column width="40px">
           <a4j:facet name="header"> Show </a4j:facet>
           <h:selectBooleanCheckbox value="#{index.shown}">
                     <a4j:support event="onclick" reRender="compsTable, testtest"/>
           <rich:column width="250px" style="text-align:right;">
                <a4j:facet name="header"> Min Value </a4j:facet>
                <rich:inputNumberSlider id="minRangeSlider"
                          onmouseup="slide(this)" oninputkeyup="slide(this)"
                     <a4j:support event="onchange" reRender="minRangeSlider"/>


      Here I have a list of checkboxes and sliders. And for every checkbox that is checked, a column should be shown in the next table:



      <a4j:outputPanel id="companies" ajaxRendered="true">
           <rich:extendedDataTable value="#{asetsScreener.comps}" id="compsTable" 
                                   var="comp" selectionMode="none"  height="210px" >
                 <rich:column visible="true">
                      <f:facet name="header">
                           <h:outputText value="Company"/>
                      <h:outputText value="#{comp['CompanyName']}"/>
                 <rich:columns value="#{asetsScreener.indexes}" var="column" 
                      <f:facet name="header">
                           <h:outputText value="#{column.indicator}"/>
                      <h:outputText value="#{comp[column.indicator]}"/>
           <h:outputText value="#{asetsScreener.indexes[1].shown}" id="testtest"/>



      If I check some boxes and hit refresh, the right columns are diplayed. But I don't want it on page refresh, I want it on checkbox event.

      If I change the value of the inputNumberSlider, then all the columns are made visible although no checkbox is checked.


      It has a wired behaviour.


      I would be gratefull if you guys could help me with this.






      And almoust forget. I use RF 3.3.3 Final with facelets. on tomcat 6