MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-1566

Nested Table - odd behavior when calling setRowIndex


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      I have tables nested 3 levels deep and when the user clicks an Update button I need to get the value of a selectBooleanCheckbox that is contained in the inner most table. I have a recursive method which calls setRowIndex on the UIData - it loops through the root table rows, and for each row in that table, calls the method to loop through the second level table rows, etc. So, the root table index gets set to 0, and it then loops through the 2nd level table rows, sets the index to 0, and then loops through the innermost table rows, checking the value of the check box. I called getAttributes().get("value") on the UIData to get the list of rows. When the checkbox is checked, I need to remove the row, so I call list.remove(row) to do so. I then used setValue on UIData to set the value to the new list, after removing the row.

      I have seen some strange behavior, so I'm wondering if this programatic setting of rows is an ok approach. The reason I'm using it is because the application is a generic one that supports plugging in new data types, which use the same type of page for the user to add/delete child objects for the data type.

      The strange behavior I have seen is:
      1. The getValue method on the check box - it often returns false, even when it is checked. It always seems to return the correct value for the rows in the first row of the second level table (outermost table index set to 0, second level table index set to zero), but returns false for the first row for all other row values in the second level table (outermost table index set to 0, second level table index set to anything greater than 0). My outer most table only has 1 entry at the moment, so I don't know what would happen if this had more rows.
      2. When I remove a row and then call setValue(newListWithRowRemoved), it seems that this list becomes the value for all row indexes of the second level table. For example, I set the index of the outer most table to zero, set the index of the second level table to 0, and then loop through the rows in the inner most table. I see that the checkbox is checked for row 1, I remove the row, and call setValue on the UIData for the inner most table. I then continue looping through, setting the index of the second level table to 1, and checking all the rows in the inner most table. The rows of the inner most table will now have the values from when the second level table had it's index set to 0, even though the second level table now has its index set to 1.

        Issue Links


          Gina Marksteiner created issue -
          Leonardo Uribe made changes -
          Field Original Value New Value
          Project MyFaces Core [ 10600 ] MyFaces Tomahawk [ 12310272 ]
          Key MYFACES-1313 TOMAHAWK-1566
          Leonardo Uribe made changes -
          Link This issue is part of TOMAHAWK-1552 [ TOMAHAWK-1552 ]
          Leonardo Uribe made changes -
          Link This issue duplicates TOMAHAWK-961 [ TOMAHAWK-961 ]
          Leonardo Uribe made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Leonardo Uribe [ lu4242 ]
          Resolution Duplicate [ 3 ]


            • Assignee:
              Leonardo Uribe
              Gina Marksteiner
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: