cancel
Showing results for 
Search instead for 
Did you mean: 

Button parameter mapping for tree tables (nw04)

Former Member
0 Kudos

I've successfully implemented a table including a master column, which is bound to a context tree node. The table has property selectionMode: none

Next to the master column I have a couple of columns, one containing a button. This button has property onAction: ShowInfo.

In the corresponding method 'onActionShowInfo' I want to show a dialog containing information belong to the row of the pressed button. How can I obtain some kind of reference to the corresponding row of the clicked button?

Grtz,

Chris

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

@ Charan,

I tried all three references, none work. I've put it back to the most obvious, which is the private one, as that one is used for the master column

@ Armin,

I created a new action, including the correct parameter. No warnings so far. As soon as I set the onAction attribute to this new action, I get these warnings.

Should I not set the onAction attribute in design time?

grtz,

Chris

Former Member
0 Kudos

Ok, I see. I thought the warning occurs only after mapping the event parameter. However, forget the warning, it is completely useless. You should use the IDE to assign the action and also the Parameter Mapping editor (if available in your version, check context menu in Outline view).

The action parameter should either be of type IWDNodeElement (and you can cast it yourself inside the action handler) or of type IPrivate<ViewController>.I<Node>Element.

Armin

Answers (4)

Answers (4)

Former Member
0 Kudos

Armin & Charan,

Thanks for your time and input! I have got it working now, thanks to your help.

The last problem was I had a typo (towards another button) in the view.getElement call.... whoops.

Anyway, I've got it working now, though it is a bit of a shame of the warnings (I tend to minimize warnings in order to detect useful warnings more easily)

Again, thanks! Points are on their way

Grtz,

Chris

Former Member
0 Kudos

Your are right about the useless warnings. In fact I have reported this issue already some time ago internally. Maybe you want to open another OSS message (BC-DWB-WD-JAV).

Armin

Former Member
0 Kudos

Hi Charan,

That is exactly what I did, but I still get the same error. I'm probably missing something trivial.

As soon as I add the parameter 'element' to the action, I get the two warnings.

I'm assuming that the type of element can somehow not be resolved. When I search for the treeNodeElement I find 3 references. One private, one from the originating custom controller and some other controller. I tried both the private one and the originating.

Former Member
0 Kudos

Yes,

You are selecting wrong element.

Carefully select the element of the Node which you binded to the table.

I think this is the issue.

Regards,

Charan

Former Member
0 Kudos

Strange. You should get these (useless) warnings only when you define the parameter mapping using the "Parameter Mapping editor", not when you define it by code.

Armin

Former Member
0 Kudos

Hi Charan

Thanks for your quick reply.

Unfortunately I get a warnings in developer studio and a null pointer as resulting element in runtime. The warnings are:

UIElementEventBinding onAction: Parameter element(iTestValuesNodeElement) cannot be supplied

Button ButtonShowInfo [onAction]: Action and event are not compatible

What am I missing here?

Former Member
0 Kudos

The warnings are nonsense. Make sure that the action parameter has exactly the same name (case-sensitive) as the string given in the addSourceMapping("nodeElement", actionParameterName) statement.

Armin

Former Member
0 Kudos

Hi,

How did you select the parameter to the onActionShowInfo action.

Check you followed the below procedure exactly.

1. Go to the actions tab in your view

2. select the onActionShowInfo

3. Go to the parameters secion and select new

4. Enter the name as "element" && Select the lookup beside type

5. Select Java native type radio button.

6. Select browse

7. Now search for ITestValuesNodeElement and select this one

Note: The name of this parameter must be "element" only. Because we have mapped the element with this name in wdModifyView() method.

Regards,

Charan

Former Member
0 Kudos

Hi,

Do the source mapping in wdDoModifyView as below to the button UI element you created in second column.

IWDButton button = (IWDButton) view.getElement("Button");
button.mappingOfOnAction().addSourceMapping("nodeElement", "element");

Note: Here "Button" is the Id of the Button UI element.

After this for example you binded "TestValuesNode" to the table (which is having master column) then for 'onActionShowInfo' action add that node element as arguement with arguement name as "element" (this is must - bcause we did the source mapping with the name "element" ) as below.

public void onActionShowInfo (com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, IPrivateTestView.ITestValuesNodeElement element )
  {
    //@@begin onActionViewProposalDetails(ServerEvent)
  
      wdComponentAPI.getMessageManager().reportSuccess(element.getValue());
    
    //@@end
  }

Regards,

Charan