Skip to Content
0
Former Member
Apr 02, 2008 at 11:05 AM

Binding different Context nodes to different Table UI elements dynamicly

11 Views

Hello Everybody,

I've a very interesting problem:

I'm getting data from R3 over RFC, and load it into context into the following context structure

Context
|
|- Node_1  //representing the tables on UI
|    |
|    |- Node_2  //representing the rows of table
|    |     |
|    |     |- attributes  // cells of a table
|    |
|    |- attributes  //other infos for a table
|
|-attributes

The data I get, is representing different lists which contains lists and I wanna load into different tables, but the size of the lists are dynamic, so I use the wdModifyView static method.

So I write the code as follows:

    IWDTransparentContainer root = (IWDTransparentContainer)view.getRootElement();
    for (int i=0; i<wdContext.node_1().size(); i++) {
      INode_1Element elem = wdContext.node_1().getNode_1ElementAt(i);
      IWDTray tray = (IWDTray)view.createElement(IWDTray.class, "tray"+i);
      IWDCaption header = (IWDCaption)view.createElement(IWDCaption.class, "tray_header"+i);
      header.setText(elem.getattr_of_Node_1_nr_1());
      tray.setHeader(header);
      IWDTable table = (IWDTable)view.createElement(IWDTable.class, "table"+i);
      table.bindDataSource(elem.node().getChildNode("Node_2", elem.index()).getNodeInfo());
      IWDTableColumn column = (IWDTableColumn)view.createElement(IWDTableColumn.class, "attr_1_column"+i);
      IWDTextView editor = (IWDTextView)view.createElement(IWDTextView.class, "attr_1_editor"+i);
      editor.bindText(elem.node().getChildNode("Node_2", elem.index()).getNodeInfo().getAttribute("attr_of_Node_2_nr_1"));
      column.setTableCellEditor(editor);
      IWDCaption headerAttr_1 = (IWDCaption)view.createElement(IWDCaption.class, "attr_1_header"+i);
      headerAttr_1.setText("ATTR_1");
      column.setHeader(headerAttr_1);
      table.setVisibleRowCount(10);
      table.addGroupedColumn(column);
... //adding other tables the same way

But when I load the page, the same data is in every table UI element. When I export this context to an Excel, it's correct, but the tables seems to be binded the same node.

Please help me ASAP!

Thanks & Best regards:

David