cancel
Showing results for 
Search instead for 
Did you mean: 

Tree and Table UI element with same data source (context)

Former Member
0 Kudos

Hello,

I am trying to build an application which shows an tree and an table UI which shows additional information to the selected tree node. (like Windows Explorer)

I am using an context like this:

Class - - - - - - - - -- (Mapped value Node)

- SubClass - - - - - (Recursion Node)

- id - - - - - - - - -- - -(Value attribute)

- name - - - - - - - - -(Value attribute)

.

.

For the tree I am unsing this event handler

	public void onActionClassNodeSelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, de.aequitas.sap.wd.java.easyclass.wdp.IPrivateEasyClassView.IClassElement element )

wdModifyView contains this:

public static void wdDoModifyView(IPrivateEasyClassView wdThis, IPrivateEasyClassView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView
	IWDTable pictureTable = (IWDTable) view.getElement("PictureTable");
    if(firstTime)
    {
    	IWDTreeNodeType node = (IWDTreeNodeType) view.getElement("TreeNodeType");
    	node.mappingOfOnLoadChildren().addSourceMapping("path", "element");
    	node.mappingOfOnAction().addSourceMapping("path", "element");
    }

I think I could use now

pictureTable.bindDataSource()

, but do not know where to get the needed parameter.

Thank You

Bernd

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

with the code

//Your existing code
IWDTable pictureTable = (IWDTable) view.getElement("PictureTable");
 
 
//use the following code for binding
IWDNodeInfo nodeInfo = wdContext.nodeClass().getNodeInfo();// Assuming class Node is bound to table.
pictureTable.bindDataSource(nodeInfo);

I have the problem that the table is showing permanent the nodes of the first level. If I select an element in the tree, the table should show the content of this element (second level), but it is still showing the top level information.

Thank you

Bernd

Former Member
0 Kudos

Are the detail data all available in the node to which the tree is bound? In the Windows Explorer it's more like a separate node for the files of the currently selected folder.

Providing the details for the currently selected class could be implemented like this:


Context
+ Class
   + SubClass
      - id
      - name
+ Details (supply function=supplyDetails)
   - attribute1
   - attribute2

In the selection handler, just call


wdContext.nodeDetails().invalidate();

which triggers the supply function. Implements the supply function such that it fills the "Details" node with the details for the currently selected tree node (=tree selection of node "Class"):


void supplyDetails(...)
{
  IClassElement selectedClass = (IClassElement) wdContext.nodeClass().getTreeSelection();
  /* fill node with details for selected class... */
}

Armin

Former Member
0 Kudos

>

> Hello,

>

> I am trying to build an application which shows an tree and an table UI which shows additional information to the selected tree node. (like Windows Explorer)

>

> I am using an context like this:

> Class - - - - - - - - -- (Mapped value Node)

> - SubClass - - - - - (Recursion Node)

> - id - - - - - - - - -- - -(Value attribute)

> - name - - - - - - - - -(Value attribute)

> .

> .

>

> For the tree I am unsing this event handler

>

	public void onActionClassNodeSelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, de.aequitas.sap.wd.java.easyclass.wdp.IPrivateEasyClassView.IClassElement element )

>

> wdModifyView contains this:

>

>

public static void wdDoModifyView(IPrivateEasyClassView wdThis, IPrivateEasyClassView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
>   {
>     //@@begin wdDoModifyView
> 	IWDTable pictureTable = (IWDTable) view.getElement("PictureTable");
>     if(firstTime)
>     {
>     	IWDTreeNodeType node = (IWDTreeNodeType) view.getElement("TreeNodeType");
>     	node.mappingOfOnLoadChildren().addSourceMapping("path", "element");
>     	node.mappingOfOnAction().addSourceMapping("path", "element");
>     }

>

> I think I could use now

pictureTable.bindDataSource()

, but do not know where to get the needed parameter.

>

> Thank You

> Bernd

Hi,

Following is the code to do this


//Your existing code
IWDTable pictureTable = (IWDTable) view.getElement("PictureTable");


//use the following code for binding
IWDNodeInfo nodeInfo = wdContext.nodeClass().getNodeInfo();// Assuming class Node is bound to table.
pictureTable.bindDataSource(nodeInfo);

Regards

Ayyapparaj