cancel
Showing results for 
Search instead for 
Did you mean: 

Tree by nesting Table column

Former Member
0 Kudos

Hi Developers ,

I am trying to implement a simple <b>Tree by nesting Table column</b>. I have done following .

I have a table in which I have following columns.

1. Group ID

2. SubGroup ID and some other fields.

At WDDoInIt I have wriiten code to create rows corresponding to all Goup Id's

Its comming fine till now.

Now my concern is to open dynamically subgroup Id 's on click of respective group ID's.

At the view level I have created table , binded to the that node and lastly added a master column. in which I have binded childrenloaded, isleaf and expanded (all of type boolean )in the same node. and then created an action with a parameter of type this node element

for making this master column dynamic I have written this at DoModifyView.

IWDTreeByNestingTableColumn masterColumn = (IWDTreeByNestingTableColumn) view.getElement("MasterColumn");

masterColumn1.mappingOfOnLoadChildren().addSourceMapping("path", "element");

but in the action of event<b> OnLoadChildren().</b> when I am trying to use contents of element (which is return from domodifyview) its giving null.

I feel domodify method isnt returning any thing.

Regards

Abhi

Accepted Solutions (1)

Accepted Solutions (1)

former_member485701
Active Participant
0 Kudos

Hi abhay,

when you do mapping for onLoadChildren then go to the actions tab select onLoadchildren and add a parameter with name "element" of type of your TreeNodeElement.

after doing this element will automatically come to your function onLoadChildren and you can use it directly.

regards,

Praveen

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

I have followed same steps. but I am not getting an alterantive way for parameter adding , I mean I dont get any parameter mapping option on right click

on the TreeByNestingTableColumn from the Outline View.

also are trying to say event handler comes automatically once u do parameter mapping ?

If u have any code on this kindly communicate.

Thanks for your inputs.

Regards

Abhay

Former Member
0 Kudos

Hi

I think its only problem with parameter mapping because in the action of event onloadchilren I am setting some check value to local context and displaying in the same view but its showing balnk when i am expanding parent node. which in turn means that control is going from domodify view to action. I think in the following code in the domodify view

<b>string patth</b> is not being passed to action. though i have checked everything else and its fine.

IWDTreeByNestingTableColumn masterColumn1 =

(IWDTreeByNestingTableColumn) view.getElement("MasterColumn2");

masterColumn1.mappingOfOnLoadChildren().addSourceMapping("path", "element");

Regards

Abhay

Former Member
0 Kudos

Hi Praveen ,

I have checked action , I have a parameter of action <b>onLoadChildren</b> of type same node. also both name of the parameter are same.

I mean i am passing same element. but I am not able to understand.

If you have coeded anything on this topic , kindly tell me.

Regards

Abhay.

Former Member
0 Kudos

Hi,

Steps to do

1) From the properties of the TreeByNestingTableColumn create an event handler

Specify a name for the event handler.

Create parameter <b>element</b> of type com.sap.tc.webdynpro.progmodel.api.IWDNodeElement

2)

IWDTreeByNestingTableColumn masterColumn = (IWDTreeByNestingTableColumn) view.getElement("MasterColumn");

masterColumn1.mappingOfOnLoadChildren().addSourceMapping("path", "element");

OR

Right click on the TreeByNestingTableColumn from the Outline View.

Select Parameter mapping.

Map parameter by drag and drop [ right to left].

3) You will see a event handler as shown below

Sample event Handler

public void onActionChild(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement element )

{

//@@begin onActionChild(ServerEvent)

//@@end

}

Regards

Ayyapparaj

former_member485701
Active Participant
0 Kudos

public void onActionLoadChildren(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.a1s.bchistory.wdp.IPrivateBCHistoryView.IMasterNodeElement element )

{

//@@begin onActionLoadChildren(ServerEvent)

if(element!=null){

addElementToMasterNode(element.nodeChildTreeNode(), element

.getKey());

element.setChildrenLoaded(true);

element.setExpanded(true);

}

}

}

Now addelement Method is called in wdDoInit

public void addElementToMasterNode( com.sap.a1s.bchistory.wdp.IPrivateBCHistoryView.IMasterNodeNode masterNode, java.lang.String parentId ) {

//@@begin addElementToMasterNode()

IBCESetNode rootBCNode = wdContext.currentCommonVariablesElement().getRootBCNode();

if (parentId.equalsIgnoreCase("ROOT")) {

Update at the 1st level..

}else{

//when you click on the element for children loading

}

}

Try this...

Regards,

Praveen

Former Member
0 Kudos

Hi,

Have you provided the same name of the parameter as element in your action onLoadChildren (case sensitivity).

Regards,

Murtuza