Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
Description
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.
Attachments
Issue Links
- duplicates
-
TOMAHAWK-961 Deleting a row when t:dataList/t:dataTable preserveRowStates=true assigns submitted values to wrong row
- Closed
- is part of
-
TOMAHAWK-1552 t:dataList, t:dataTable ajax
- Closed