pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lebaudya <andres.leba...@gmail.com>
Subject TableView in Dynamic Form
Date Fri, 13 Jul 2012 15:09:18 GMT
I need to build a Form dynamically.  In some cases, the form is to include a
TableView but I am having trouble getting it to appear.

If I use a bxml file definition, it works fine.  However, if I create the
objects in code, the TableView does not appear.  I've been
fighting with this for a couple of days and would appreciate any guidance. 
Thanks!

Here's the bxml snip (which works):

    <Form>
        <Form.Section>
            <ScrollPane>
                <TableView bxml:id="tableView">
                    <columns>
                        <TableView.Column name="x" width="100"
headerData="X"/>
                        <TableView.Column name="y" width="100"
headerData="Y"/>
                        <TableView.Column name="z" width="100"
headerData="Z"/>
                    </columns>

                    <collections:HashMap x="100" y="200" z="300"/>
                    <collections:HashMap x="400" y="500" z="600"/>
                </TableView>

                <columnHeader>
                    <TableViewHeader tableView="$tableView"
styles="{includeTrailingVerticalGridLine:true}"/>
                </columnHeader>
            </ScrollPane>											 
        </Form.Section>
    </Form>			                        

Here's the java code (which isn't working):

    List<Map&lt;String, String>>tableData = new ArrayList();
    Map<String, String> map = new HashMap();
    map.put("x", "100");
    map.put("y", "200");
    map.put("z", "300");
    tableData.add(map);
    map = new HashMap();
    map.put("x", "400");
    map.put("y", "500");
    map.put("z", "600");
    tableData.add(map);

    TableView tableView = new TableView(tableData);
    ColumnSequence columns = tableView.getColumns();
    columns.add(new Column("x", "X", 100));
    columns.add(new Column("y", "Y", 100));
    columns.add(new Column("z", "Z", 100));

    TableViewHeader header = new TableViewHeader();
    try {
        header.setStyles("{includeTrailingVerticalGridLine:true}");
    } catch (SerializationException e) {
    }
    header.setTableView(tableView);
    	
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.insert(tableView, 0);
    scrollPane.setColumnHeader(header);
   		
    Form form = new Form();
    Form.Section section = new Form.Section();
    form.getSections().add(section);
    section.add(scrollPane);

Anybody see what I'm missing?

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TableView-in-Dynamic-Form-tp4021952.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Mime
View raw message