Okay, the problem is when I'm creating a new Survey.  New Surveys don't have any SurveyElements so the ListView is empty.  When I try to add a Panel to the ListView using a Form Button, the ListView doesn't update on the page.  Here's how I'm trying to do it:

// "elements" is a ListView object initialized earlier.

add(new Button("addAnotherElementButton") {
    protected void onSubmit() {
        elements.modelChanging();
        List<SurveyElement> l = (List<SurveyElement>) elements.getList();
        if (Util.isEmptyOrNull(l)) {
            l = new ArrayList<SurveyElement>();
        }
        elements.removeAll();
        l.add(getSurveyElement(getAddElement()));
        elements.modelChanged();
    }
});

However, this doesn't work.  Any thoughts on what I'm doing wrong?  I read in the ListView Javadoc about the removeAll() call, but I'm not sure when I should be calling that.  Additionally, it's unclear to mean if the ListView has the new ListItem and it's just not rendering, or if the new ListItem isn't being added. 

Reply via email to