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&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.




Reply via email to