7 Replies Latest reply on Mar 14, 2007 11:21 AM by javajoe220

    datatable / datascroller issue

    javajoe220

      Hello,
      I am currently using <a:commandButton .. to populate a rich:dataTable.

      Part of what this does is submit some check boxes to determine which columns to show. This part works great. The problem is when I introduce the datascroller it completely ignores the backing bean data with the criteria as to which column should be displayed. The result is none of the optional columns are displayed. So in the example below "Date" will be displayed but not "Amount". Other than this the paging is working correctly.

      I tried putting everything relevant into the same <a:region to no avail. Any thoughts on what I could be doing wrong? - Thanks!

      <h:form>
       <a:region id="selectionRegion">
       <rich:simpleTogglePanel label="Selection Criteria" switchType="client">
       <h:panelGroup>
       <h:selectBooleanCheckbox value="#{backingBean.showColumn}"/>
       <h:outputText value="Show me"/>
       <a:commandButton value="Get Data"
       action="#{backingBean.fetchData}"
       reRender="ajaxTran"/>
      
       <a:status startText="Fetching Data..." stopText=""/>
       </h:panelGroup>
       </rich:simpleTogglePanel>
       <rich:simpleTogglePanel label="Ledger Transactions" switchType="client">
       <h:panelGroup>
       <a:outputPanel id="ajaxTran">
       <rich:dataTable id="tranTable">
       .........
       <rich:column>
       #{bean.date}
       </rich:column>
       <rich:column rendered="#{backingBean.showColumn}">
       #{bean.amount}
       </rich:column>
      
       </rich:dataTable>
      
       <rich:datascroller for="tranTable"/>
      
       </a:outputPanel>
       </h:panelGroup>
       </rich:simpleTogglePanel>
       </a:region>
      </h:form>
      


        • 1. Re: datatable / datascroller issue

          If your backingBean has a request scope, it might work like you describe.
          So, what is the scope?

          • 2. Re: datatable / datascroller issue
            javajoe220

            Thanks for the quick response -
            Everything is currently conversationally scoped in Seam. The backing bean is a Stateful session bean.

            • 3. Re: datatable / datascroller issue

              I want to be sure I understand your use case correctly.

              At the first time the page is loaded the "Date" is displayed but not "Amount"

              When you check the select box and then click the button, the Amount becomes displayed

              When you click on the datascroller. the Amount becomes hidden again

              When you having the select box checked click the "Get Data" button again, the Amount becomes displayed

              Does it work like that?



              • 4. Re: datatable / datascroller issue
                javajoe220

                Yes that is correct - to clarify:

                If the "show me" checkbox is checked and the column is displayed on the screen from a "Get Data" command, and then the data scroller is used - the amount column does NOT appear but the checkbox is still checked.

                Subsequent "Get Data" commands restores the table until I use the datascroller again.

                • 5. Re: datatable / datascroller issue

                  The checkbox is not updated on the screen because you just do not update it clicking the datascroller links.

                  So, the truth is you have the backingBean.showColumn returns false on the server side during each request from the datascroller controls. It happens because the Conversation does not continue, but starts over (ant the default value is false for showColumn )

                  Try:
                  <rich:datascroller ajaxSingle="false" for="tranTable"/>

                  • 6. Re: datatable / datascroller issue

                    You may use firebug to track all requests and make sure that you always hit same conversation (normally you have conversation id between parameters)

                    • 7. Re: datatable / datascroller issue
                      javajoe220

                       

                      <rich:datascroller ajaxSingle="false" for="tranTable"/>


                      That did the trick! - thanks!