Hi Roger,
Thank you so much for your very prompt response! I had a feeling it was
something like this. Thank you again. Very helpful!
Andres
On 7/13/2012 12:56 PM, Roger and Beth Whitcomb [via Apache Pivot -
Users] wrote:
> Hi Andres,
> Thank your for using Pivot. Your Java code is almost all right.
> I think the only thing you need to change is to use "setView" to
> attach the TableView to the ScrollPane, instead of doing an "insert".
> Something like this:
> ScrollPane scrollPane = new ScrollPane();
> scrollPane.*setView*(tableView);
> scrollPane.setColumnHeader(columnHeader);
>
> There can only be one "child" of a ScrollPane, which is the "view"
> (same for all the Viewport objects). So, in this respect it is a bit
> different than other containers.
>
> HTH,
> ~Roger Whitcomb
>
> On 7/13/12 8:09 AM, lebaudya wrote:
>> 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<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.
>>
>>
>
>
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://apache-pivot-users.399431.n3.nabble.com/TableView-in-Dynamic-Form-tp4021952p4021953.html
>
>
> To unsubscribe from TableView in Dynamic Form, click here
> <http://apache-pivot-users.399431.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4021952&code=YW5kcmVzLmxlYmF1ZHlAZ21haWwuY29tfDQwMjE5NTJ8LTEwMzIzMjAxMzA=>.
> NAML
> <http://apache-pivot-users.399431.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/TableView-in-Dynamic-Form-tp4021952p4021954.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.