RF4 critical bug: <rich:dataTable> inside another <rich:dataTable> or <h:dataTable> does not update its components' values.
pablo53 Jun 7, 2011 5:58 PMHi,
After many hours of debugging some issue inside my application I found a critical bug (not to say blocker) in RF-4.0.0.Final.
Let's assume we have an array of 3 objects, and each object has (among other fields) an array of 2 objects. Now, let's try to render it on "tables-in-table" basis. Let's have a rich:dataTable with value attribute set to the "array of 3" (say, "outer table"). Then, let's have another rich:dataTable (say, "inner table") inside a rich:colulm of the outer table with value set to a field pointing to the "array of 2".
The above will render the data correctly, but if we try to change any data inside the inner table (except the last inner table - i.e. the one inside the last row of the outer table) we will fail.
This is an example:
@SessionScoped
public class MyBean implements java.io.Serializable {
// ...
public static class Test007a implements java.io.Serializable {
private Date myDateA = null;
public Date getMyDateA() { return this.myDateA; }
public void setMyDateA(Date myDateA) { this.myDateA = myDateA; }
}
public static class Test007 implements java.io.Serializable {
private Date myDate = null;
private java.util.List<Test007a> mySubDates = new java.util.ArrayList<Test007a>();
public Test007() { mySubDates.add(new Test007a()); mySubDates.add(new Test007a()); }
public Date getMyDate() { return this.myDate; }
public void setMyDate(Date myDate) { this.myDate = myDate; }
public java.util.List<Test007a> getMySubDates() { return mySubDates; }
public void setMySubDates(java.util.List<Test007a> mySubDates) { this.mySubDates = mySubDates; }
}
private Test007[] lll = new Test007[] { new Test007(), new Test007(), new Test007() };
public Test007[] getLll() { return this.lll; };
}
and a fragment of XHTML:
<rich:dataTable value="#{myBean.lll}" var="mm">
<rich:column>TEST</rich:column>
<rich:column><rich:calendar value="#{mm.myDate}" datePattern="yyyy-MM-dd" enableManualInput="true" /></rich:column>
<rich:column>
<rich:dataTable value="#{mm.mySubDates}" var="mm2">
<rich:column>SUB-TEST</rich:column>
<rich:column><rich:calendar value="#{mm2.myDateA}" datePattern="yyyy-MM-dd" enableManualInput="true" /></rich:column>
</rich:dataTable>
</rich:column>
</rich:dataTable>
Try to fill all the calendars. You will find that the calendars in the inner tables, except the inner table in the last row of the outer table, loose their values after postbacks. If we change <rich:dataTable> and <rich:column> to <h:dataTable> and <h:column> (respectively) everything starts to work as expected. Mixing outer "rich:" and inner "h:" versions make things even worse - ale the inner tables have the same client ids in the corresponding fields (at least, this is what I noticed in Mojarra 2.1.1).
To sum up, the above example show a serious bug in RF 4.0 (running on Mojarra 2.0.4 and 2.1.1; other versions of Mojarra are also suspected, but I have not tested them).
Regards,
P.S. Sorry for the variable names in the example.