You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Pablo S." <ps...@hotmail.com> on 2008/10/03 06:34:01 UTC

DefaultDataTable attached to a model in a form

Hi, I have a form with some fields attached to some properties of a model, 
so when I change the model all the fields also changes. Up to that 
everything goes perfect, the problem I'm having is that I need to maintain a 
DefaultDataTable in the form with the data of a list that the model has. I 
don't know how to fill that table with the list property of the model.

Here I paste the code:

public InvoiceForm(String name, InvoiceModel model){
        super(name, new CompoundPropertyModel<InvoiceModel>(model));
        TextField<String> orderNumber = new TextField<String>("number", new 
PropertyModel<String>(model, "number"));
        add(orderNumber);
        TextField<String> customerTxt = new TextField<String>("customerStr", 
new PropertyModel<String>(model, "customerStr"));
        add(customerTxt);
        TextField<String> totalTxt = new TextField<String>("total", new 
PropertyModel<String>(model, "total"));
        add(totalTxt);

        List<IColumn<?>> columns = new ArrayList<IColumn<?>>();
        columns.add(new PropertyColumn(new Model<String>("Name"), "name"));        columns.add(new DateColumn(new Model<String>("Upload Date"), "uploadDate", "uploadDate"));
        columns.add(new PropertyColumn(new Model<String>("Quote"), "quote", 
"quote"));
        List<Document> docs = model.getDocuments();
        DefaultDataTable table = new DefaultDataTable("items", columns, new 
SortableDocumentDataProvider(docs), 8);
        add(table);
}

The way I'm linking the table with the form is wrong, I would like to know 
how I can solved this

Thanks
Pablo 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org