gwtuibindercelllist

Using two nested CellLists


I'm trying to use two nested Cell-Lists while using the GWT UI-Binder for both of these lists. Basically, I have a model-list, and every model-element contains an article-list as an UI-field. Unfortunately, a model-element (which is an AbstractCell-class) can't bind another CellList as an UI-field because AbstractCell is not a Widget. The only solution I found is passing the article-list as an HTML-string in the render-method of the AbstractCell-class.

So my question is whether there is any possibility to use a CellList (article-list) as an UI-field in another CellList (model-list) while using the UI-Binder for both of these lists?


Solution

  • The CellList is a very flat Widget type. Basically you are just rendering cells by returning HTML. Therefore you will not be able to easily nest another Widget into a CellList.

    I would also think that your UI might be complicated for the user if there is another list inside your main list - if I did not get you wrong on that?

    Usually I would solve that by providing two lists - either one over the other or side-by-side. The first list is the main or master list and the second one is the child list. If you select an item in the master list, you populate the child list with all according child entries. And if you put a label "model" and "article" on them, it should be pretty clear to the user. Just keep the master list first in your UI first - at least if your UI is targeted to left-to-right (RTL) reading people.