cancel
Showing results for 
Search instead for 
Did you mean: 

Binding different Context nodes to different Table UI elements dynamicly

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try to set the leadselection after this line

INode_1Element elem = wdContext.node_1().getNode_1ElementAt(i);

wdContext.node_1().setLeadSelection(i);

Regards

Ayyapparaj

Former Member
0 Kudos

First of all Thanks for quick response.

Unfortunetly this didn't help me. The only thing changed that the data in tables is the last nodeElem of Node_1 instead of the first one.

Any other idea?

Thanks & Regards:

David

Former Member
0 Kudos

It's not possible to bind tables to such nested (non-singleton) subnodes. You will always get the child node data of the lead-selection in the outer node.

Armin

Former Member
0 Kudos

And is there any way to solve this problem? Maybe reorganize the context? Or tricking with leadselection? It would be great to solve this problem in WebDynpro.

Thanks & Regards:

David

Former Member
0 Kudos

You could "solve" it by creating separate nodes on root-level for each (Node1-element, Node2) pair of the nested node structure. Then you could bind tables to these new nodes.

Armin

Former Member
0 Kudos

Wow!

It sounds a big waste of time! You mean that I should create the different nodes dynamicly, than I'll be able to bind this nodes to dynamicly created tables? Is there any tutorials that can be a good point to start this process?

Thanks & Regards:

David

Former Member
0 Kudos

Thank you very much for your idea. I was able to generate the nodes and tables dynamicly. It's not a nice code, but I had to walk this way

Thanks again & regards:

David

Answers (0)