Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1352

The Status of DataTable wasn't saved when use HashMap to reserve DataSource.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1.10
    • None
    • None
    • tomahawk 1.1.7
      myfaces-core-1.1.6

    Description

      I'm using a HashMap to reserve the form values.
      The search result is a type of ArrayList. It is needed to edit the search result and then save them to database and redisplay the datatable.
      But when redisplay the datatable, I found that the Status was not saved. It only dispaly ONE ROW in the datatable.

      I trace the source and found the following source in AbstractHtmlDataTable.java:
      // Method Name: updateModelFromPreservedDataModel

      517 if (lst!= null && lst.size() > 0)
      518

      { 519 vb.setValue(context, lst.get(0)); 520 }

      At the row 519, the ArrayList was constrained to ONE RECORD Array.

      I changed the source as following, and it works fine.

      517 if (lst!= null && lst.size() > 0)
      518

      { 519 vb.setValue(context, lst); 520 }

      I don't know why it was restraned to one record array,
      But perhaps reduce the restrains may make myfaces more flexible.

      thanks a lot in advance.

      Attachments

        1. AbstractHtmlDataTable.java.patch
          0.5 kB
          Tang Yongkang
        2. testBean.java
          0.8 kB
          Tang Yongkang
        3. dataTable2.jsp
          1 kB
          Tang Yongkang

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              tangyongkang Tang Yongkang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: