10 Replies Latest reply on May 2, 2011 8:05 AM by lfryc

    Datatable partial update - rowsToUpdate

    skunjumohamed

      Hi guys,

       

      I am confused of how to use the partial update of a datatable, I mean updating the selected rows of the datatable on an event. Earlier in RF 3, it has been done by ajaxKeys, now it is not there and I understand it is being done as specified in this link -

       

      http://docs.jboss.org/richfaces/latest_4_0_X/Component_Reference/en-US/html/chap-Component_Reference-Tables_and_grids.html#sect-Component_Reference-a4jrepeat-Limited_views_and_partial_updates.

       

      Over there, it is mentioned that if we want to refresh only one or more rows in a table, use variables to specify references as follows.

       

      render=tableId:#{@rows(bean.rowToUpdate)}:cellId
      
      
      

      I think there is a mistake in the syntax given here, the correct form should be(I assume) -

       

       

      render=tableId:@rows(#{bean.rowToUpdate}):cellId
      
      

       

      And it says, "The @rows function accepts a collection of row keys to be updated.". I tried different collections here, List, Set etc, but it failed saying -

       

      de.odysseus.el.tree.TreeBuilderException: Error parsing '#{[0]}': syntax error at position 2, encountered '[', expected <IDENTIFIER>|<STRING>|<FLOAT>|<INTEGER>|'true'|'false'|'null'|'-'|'!'|'not'|'empty'|'('

       

      Can some one help on this, what is the correct usage ?

       

      Also, if I want to refresh the whole row, what is the syntax ? Is it as here ?

       

      render=tableId:@rows(#{bean.rowToUpdate})
      
      
      

      Or should I give a comma separated list of columns ? like..

       

      tableId:@rows(#{bean.rowToUpdate}):col1, tableId:@rows(#{bean.rowToUpdate}):col2, ...
        • 1. Re: Datatable partial update - rowsToUpdate
          nbelaevski

          Hi Shameer,

           

          It should be the following:

           

          render="tableId:@rows(bean.rowToUpdate):cellId"

           

          You should use space- or comma-separated list of columns.

          • 2. Re: Datatable partial update - rowsToUpdate
            skunjumohamed

            Thanks Nick, for the answer.

             

            It works when the event is invoked from outside the datatable. ie, a button outside the datatable can re-render a row(with a hard-coded row-index - rowToUpdate).

             

            However, if I move the same button to a column inside the datatable(then the button will get repeated in all rows), then the event is fired and the listener method is executed, but the render doesn't work.

             

            I am trying to get a row editable on row-click. the row-click itself has a bug, as given in this thread[164648] . I am using the work around of using the jsFunction to pass tge currentRow for the time being.

             

            It works if I refresh/render the whole data-grid which is not practical to me, but I am not able to render the selected rows partially, it doesnt refresh.

            • 3. Re: Datatable partial update - rowsToUpdate
              skunjumohamed

              Nick,

               

              It is not actually working even from outside the datatable. It was the whole page/region refresh.

               

              If you give refresh="tableId", it refreshes the whole table. But if you give render="tableId:@rows(bean.rowToUpdate)" or render="tableId:@rows(bean.rowToUpdate):cellId", it doesn't return anything from the server-side, except the view-state data.

               

              Can you please send me a working sample of datatable with partial update on selected rows(using the syntax you have suggested) ?

              I couldn't see one even in the RF demo, datatable section.

               

              This issue is blocking our development, please help me to get this removed. This is a show stopper for us.

              • 4. Datatable partial update - rowsToUpdate
                nbelaevski

                So, column ID doesn't work as column is rendered by data table. You can update component located in the column:

                 

                <h:form>

                                    <rich:dataTable value="#{capitalsBean.capitals}" var="cap" id="table">

                                              <rich:column id="name">

                                                        <h:outputText value="#{cap.name}" />

                                              </rich:column>

                                              <rich:column id="state">

                                                        <h:outputText value="#{cap.state}" id="text"/>

                                              </rich:column>

                                              <rich:column>

                                                        <h:outputText value="#{cap.timeZone}" />

                                              </rich:column>

                                    </rich:dataTable>

                 

                                    <a4j:commandLink render="table:@rows(capitalsBean.updateKeys):text" value="Update text" />

                          </h:form>

                • 5. Re: Datatable partial update - rowsToUpdate
                  skunjumohamed

                  That means I cannot just partially render one row as a whole using render="table:@rows(capitalsBean.updateKeys)" ?

                   

                  I already got this sample(refreshing components inside a cell) working, but it won't address my requirement. I want to conditionally hide and show some components without wrapping them by an outputPanel or something. Performance reasons . Previously, in RF3, it was possible by refreshing the columns in a row.

                  • 6. Re: Datatable partial update - rowsToUpdate
                    skunjumohamed

                    Is this a bug (that the entire row re-render is not working) ? When will it get resolved ?

                    • 7. Re: Datatable partial update - rowsToUpdate
                      skunjumohamed

                      I think this issue has a relation with the reported bug, RF-10756, where a wrong component-id to be rendered is sent back from server.

                       

                      When I try to render the row using render="table:@rows(capitalsBean.updateKeys)", I can see the content of the row is sent back to the browser, in the firebug, but it does not repaint, I think the component-id that is sent back is incorrect.

                       

                      I suppose this is the root cause for the failure of partial update within all iteration controls such as repeat, datatable, collapsiblesubtable, etc.

                      • 9. Re: Datatable partial update - rowsToUpdate
                        skunjumohamed

                        Hi Nick,

                         

                        The above example you have given above [to update a component inside a column in a row, instead of that row as a whole], works, but still has a problem in it.

                         

                        If I change the order of the item list internally, and refresh the table partially(only few relevant rows), it renders in the same old oder(before re-ordering). I have printed the item order into log messages, and compared to the rendered partial update, confirmed the difference. While the server-side list is changed in order, the rendered partial update is in the old order.

                         

                        It was working perfectly in RF 3. Is there a work around for this ?

                         

                        Also, when are the planned release for 4.0.1.Milestone1, 4.1.0.Milestone1 and 4.Future ? Hope these would fix few bugs which are blocking us.

                        • 10. Datatable partial update - rowsToUpdate
                          lfryc

                          Hi Shameer,

                           

                          could you please provide us minimalistic sample application where we can reproduce your issue?

                           

                           

                          Could can also vote on issues which have Ilya posted before?

                           

                           

                          Thank you,

                           

                          - Lukas