Menu

#607 Data binding generates duplicate ids in grids/listboxes

2.4.1
closed
nobody
None
5
2007-10-15
2007-10-14
No

This problem arises when you are using annotations on grids or listboxes, together with a model to control dynamic generation of the grid or listbox. If you use components from the xhtml namespace inside your grid rows or listcells, you get duplicate id errors in this case. Regular xul components do not show the problem, but xhtml components do (perhaps because of the different ways their ids are managed?).

One possible fix for this problem is to modify the org.zkoss.zkplus.databind.BindingRowRenderer class. In the setupCloneIds() method on line 127, change this:

clone.setId("@"+clone.getUuid());

to this:

clone.setId("@" + clone.getUuid() + x++);

This mirrors the corresponding clone.setId() call on line 54 in newRow(), and fixes the problem. A similar change has to be made in the BindingListItemRenderer on line 129.

Discussion

  • Stephen H. Edwards

    Logged In: YES
    user_id=1296748
    Originator: YES

    I almost forgot: In order for this fix to work, you also need to fix bug 1813060, "AbstractTag.clone() causes NPE". Otherwise you'll see the NPE.

     
  • Henri Chen

    Henri Chen - 2007-10-15

    Logged In: YES
    user_id=89247
    Originator: NO

    Fixed since 10/15.

    ----
    Thanks for the detailed reports.

     
  • Henri Chen

    Henri Chen - 2007-10-15
    • status: open --> closed
     

Log in to post a comment.