4 Replies Latest reply on May 11, 2011 12:49 AM by kardanov

    RichFaces: extendedDataTable and resizing.

    kardanov

      I've just started with RichFaces and have some problem issues.

       

      1. I'm using <rich:extendedDataTable>. I specified raws attribute as "10", but the amount or rows in my case is different from time to time, so the table does resize all the times. Is there way to fix row count, I want 10 raws per page all the time independently on the count of actual data (if there will be less than 10 raws, I want just empty extra rows)?

       

      2. I want to block resizing of the columns and totally disable horizontal scrollbar. There should be always few (e.g. 3) columns of predefined width and they shouldn't be changed.

       

      If there any ideas I will really appreciate your help.

      Thanks.

        • 1. RichFaces begginer's questions.
          lfryc

          Hello,

           

          1. actually @rows attribute should limit displayed number of rows and you need to use dataScroller (or other way) to scroll through your model. When it is not working for you, could you please post your sample (managed bean + XHTML) or directly a sample application source?

           

          1b. According to extra rows - this is not built-in feature - you have several options: a) customize component to your requirements, b) trigger a feature request in RichFaces JIRA, c) wrap your model that EDT will get empty extra data model items on the end of data collection

           

          2. Disabling of features like resizing/disabling horizontal scrollbar are reasonable feature requests - could you please fire a Feature Request in RichFaces JIRA?

          1 of 1 people found this helpful
          • 2. RichFaces begginer's questions.
            kardanov

            Hello and thank you for your reply.

             

            1. Yes, @rows attributes limit number of displayed rows, and if I set it to 10, only 10 of them per page are shown. But some times I have e.g. 5 rows, but I want 10 rows to be displayed (5 rows with actual data and 5 extra empty rows). As I understood there are no built-in possibility to do this. If you can describe how to customize component (or follow me to some place where it is already described), it will be really appreciated.

            Here is my sample as you asked me, but there is nothing exciting in it:

            Part of my index.xhtml:

            <rich:extendedDataTable rows="10" id="myElements" style="width:100%" var="element" value="#{myBean.elements}">

                      <rich:column width="364px" label="Element field 1">

                                <f:facet name="header">

                                          <h:outputText value="Field 1" id="field1" />

                                </f:facet>

                                <h:outputText value="#{element.field1}" />

                      </rich:column>

                      <rich:column sortable="true" width="364px" sortBy="#{element.field2}" label="Element field 2" filterBy="#{element.field2}" filterEvent="onkeyup">

                                <f:facet name="header">

                                          <h:outputText value="Field 2" id="field2" />

                                </f:facet>

                                <h:outputText value="#{element.field2}" />

                      </rich:column>

            </rich:extendedDataTable>

            <rich:dataScroller for="myElements" maxPages="3" />

             

            As you can see there is data scroller, which splits data into (max) 3 pages by 10 rows in each. But the point is to handle situations with less than 10 rows as i described above.

             

            My managed bean is really simple with list of elements, each with two fields as specified.

             

            Thanks in advance for any help.

            • 3. RichFaces begginer's questions.
              lfryc

              My point was use your dataModel (#{myBean.elements}) as the entry point for adding empty rows.

               

              Say you will create separated method (#{myBean.elementsIncludingEmpty}) that will internally use (wrap) MyBean#getElements() and in cases there are too many elements, it will add relevant number of empty elements.

               

              This is simplest solution and it presumes that there will be no errors when using empty elements.

              • 4. RichFaces begginer's questions.
                kardanov

                Thank you for the reply and for help.

                That was an idea I thought about,so will do it in this way.