6 Replies Latest reply on Jun 9, 2010 7:15 AM by ammaletu

    ExtendedDataTable: columns displayed in wrong order

    ammaletu

      I'm still working on the view containing an extended data table, and I see another strange error there. My table has grown to contain a dynamic number of columns plus one static column. Simplified example:

       

      {code}<rich:extendedDataTable id="myTable" value="#{myBean.dataModel}" var="nextRow">
        <!-- dynamic columns -->
        <rich:columns value="#{myBean.columns}" var="nextColumn" index="fieldNumber" id="value#{fieldNumber}" width="300px">
          <f:facet name="header"><h:outputText value="#{nextColumn.name}"/></f:facet>
          <h:outputText value="#{nextRow.values[nextColumn.name]}" />
        </rich:columns>
        <!-- static column -->
        <rich:column id="mdTest" sortable="false" width="150px">
          <f:facet name="header"><h:outputText value="Test"/></f:facet>
          <h:outputText value="123" />
        </rich:column>
      </rich:extendedDataTable>
      {code}

       

      When the table is first loaded, the static column in displayd first and the dynamic ones follow. As soon as the table is rerendered (via a command link with rerender attribute), the static column jumps to the end of the table where it belongs. Any idea what could be the cause and how to solve this? rich:columns and rich:column are supposed to be useable together, right?!

        • 1. Re: ExtendedDataTable: columns displayed in wrong order
          ilya_shaikovsky

          does the same will occurs if you will change extended data table to just simple datatable?

          • 2. Re: ExtendedDataTable: columns displayed in wrong order
            ammaletu

            I just tried that, and no, it doesn't happen with a simple rich:dataTable. So... Should I open a bug for this?

            • 3. Re: ExtendedDataTable: columns displayed in wrong order
              ilya_shaikovsky

              yes please rise an issue with some simple sample.

              • 4. Re: ExtendedDataTable: columns displayed in wrong order
                ammaletu

                I tried changing the RichFaces ExtendedDataTable demo to contain a rich:columns and a rich:column, and it displayed correctly. So this doesn't happen always with the combination of these elements. I'm not quite sure under which conditions it exactly happens, but I think I'll try to create a simple example of this before opening a bug. This will take some time though. I'll be back. ;-)

                • 5. Re: ExtendedDataTable: columns displayed in wrong order
                  ilya_shaikovsky

                  maybe your table using binding or tableState mapped to object which used somewhere else also?

                  • 6. Re: ExtendedDataTable: columns displayed in wrong order
                    ammaletu

                    The error might be due to something like that. I described another problem in this thread.

                     

                    Basically, I have a view with a list of selections on the left and a table on the right. When the view is first loaded, nothing is selected and therefore the table is not displayed (rendered attribute on h:panelGroup around the table). The table is filled with a data model which gets its data from a list in a bean. The binding attribute is not used, as is the tableState attribute (I don't even have a clue what that would be for), but the selection is set in the bean. I think, right now I create a new table model when the selection changes, fill it and then call the reset method on it.

                     

                    When the user selects something on the left, the data model is filled with the appropriate data and the selection is modified in the bean, then the table is rerendered. At that point, the selection might be wrong if another table has been displayed previously (thread) and the shown data might be wrong too (thread). Also, the columns are displayed in the wrong order (this thread) until some other rerendering happens (e.g. sorting).

                     

                    I suspect that I'm missing some vital step in handling the table like this, so I would appreciate ideas what else to try. Otherwise, I'll have to build a simpler demo page to demonstrate these problems.