Here is my bean class, followed by a panel class where I set up the
PropertyModel and the ListView, followed lastly by the panel's markup

BEAN:
public class IncidentListBean implements Serializable
{
        List<Incident> incList;
        public IncidentListBean() {
                incList = new ArrayList();
        }
        
        public List getIncList() {
                return incList;
        }
        
        public void setIncList(List list) {
                incList = list;
        }
}


PANEL:
public class IncidentPanel extends Panel
{
        transient List<Incident> incList = DashboardServiceAccessor.get("SELECT 
*
FROM MY_DB");
        IncidentListBean bean = new IncidentListBean();
        PropertyModel propMod;
        ListView listView;
        WebMarkupContainer container;
        
        public IncidentPanel(String id) {
                super(id);
                
                //set up the property model that will represent the listView 
below
                bean.setIncList(incList);
                propMod = new PropertyModel(bean, "incList");
                container = new WebMarkupContainer("repeaterContainer");
                
                         //ListView
                         listView = new ListView("individualReport",
propMod) {
                            protected void populateItem(ListItem item) {
                                Incident i = new Incident();
                                i = (Incident)item.getModelObject();
                                item.add(new 
Label("description",i.getDescription()));
                             }
                        };
         }
...
}



MARKUP FOR PANEL:

<wicket:panel>
        

                      Incidents 
                <div wicket:id="newIncButton" class="newIncButton">new+</div>
        

        <div wicket:id="repeaterContainer"id="incidentReports">
                <div wicket:id="individualReport" id="individualReport">
                        <div wicket:id="description"></div>
                </div>
        </div>
</wicket:panel>


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adding-items-dynamically-to-ListView-tp3580840p3582606.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to