Is it possible to nest a dom-repeat

I have a use-case where I have a list of lists (actually a menu hierarchy) and would like to use these in a nested dom-repeat tag. The first list works fine, but including a list as an attribute of the model then fails.

public interface StoreFrontViewModel extends TemplateModel {
	@Include({"name", "tagId", "imageSource", "classification"})
	void setProducts(List<ProductMpr> products);
	List<ProductMpr> getProducts();

	@Include({"menuName", "subMenu"})
	void setMenuItems(List<MenuItem> menuItems);
	List<MenuItem> getMenuItems();
}
public class MenuItem {
    public String menuName;
    public List<MenuItem> subMenu;

    public MenuItem() {
    }

    public MenuItem(String pc, List<MenuItem> classifications) {
        this.menuName = pc;
        this.subMenu = classifications;
    }

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuItem) {
        this.menuName = menuItem;
    }

    public List<MenuItem> getSubMenu() {
        return subMenu;
    }

    public void setSubMenu(List<MenuItem> subMenu) {
        this.subMenu = subMenu;
    }
}

The above code fails on the @Include subMenu attribute.

Does anyone know if this is possible at all?

Hi Franz,

Unfortunately that’s not supported at the moment. What you can do however is to pass your properties to the client-side by using the low level Element API:

myTemplate.getElement().setProperty("menuItems", JsonSerializer.toJson(menuItems));

Please note that when using this approach, all the data stored in your model will be sent to the client. So it’s not advisable to use it with database entities that contains sensitive information, like primary keys, password hashes and so on.