Hello,

I have a process that reads a CSV data file.  The data contains lists
of people, but the number of fields, the order and the type of fields
can vary from one CSV to another.

Because the data in each column is unknown, a form is displayed with a
preview of the data in a table.  The table column headers contain
dropdown list of possible field types for each column in the csv file.
 I'm using a RepeatingView to generate the headers.

The problem is, I'm unclear how to design the CompoundPropertyModel
for the form.  I assume my model needs to contain a collection of some
sort since I have a varying number of field.  But how do I map the set
of RepeatingView->WebMarkupContainer->DropDownChoice objects to the
model as a collection?

Here's the code:

preview = importer.previewImport(new FileInputStream(dataFile),10,2);
  ...
RepeatingView headers = new RepeatingView("header");
form.add(headers);
int numFields = preview.getRecords()[0].getFields().length;
for (int j = 0; j < numFields; j++) {
  WebMarkupContainer cell = new WebMarkupContainer(headers.newChildId());
  headers.add(cell);
  cell.add(new EdiCriteriaDropDownChoice("criteria").setRequired(true));
}

And the markup:

        <table cellspacing="1">
          <tr>
                <th wicket:id="header">
                        <select name="select" wicket:id="criteria"></select>
                </th>
          </tr>
           ...
        </table>

What kind of model would work with this?

Thanks,
Tauren

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user 
list. Send a message to: "users-subscribe at wicket.apache.org" and follow the 
instructions.
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to