cancel
Showing results for 
Search instead for 
Did you mean: 

toolbar drop down by key displays null

Former Member
0 Kudos

Hi community,

I have an issue with a toolbar dorpdown by key. I am populating some static values in this dropdown in my code. Based on the value selected in the dropdown, the table is populated accordingly.

The problem is, as soon as I select a value in the toolbar dropdown, the table gets populated, but the value displayed in the dropdown changes to null. i.e. no value is displayed in the dropdown. I want my dropdown to retain the display value in order to show that the records being shown in the table correspond to this particular chosen value in the dropdown.

Can anyone please help me out with this problem.

Thanks and Regards,

Vivek

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

i am unable to locate the reason behind ur problem ,as for me; it never got the null value after selection DDown. still u can try the following...

if u wanna show which value has been selected by the user; u can also think of fixing the value,i.e. makingthe dropdown unable....this way the value will be shown by the dropdown and user will not be able to change that also..

if u want to do so, use the following lines of code:

public void onActionselect<b>UrMethod</b> ( )

{

j=1;///// j is an integer that is defined as <b>static</b> in <b>class</b> scope.

}

use the <b>wdDoModifyView ( )</b> method and implement

wdDoModifyView()

if (j==1)

{

IWDDropDownByIndex a=(IWDDropDownByIndex)view.getElement("<b>nameOfDDownUI</b>");

a.setEnabled(<b>false</b>);

}

this way the value will be fixed and will not show the null value.

hope it brings the result.

Former Member
0 Kudos

Hi Kushagra,

thanks for the reply. This kind of approach may not work as this will deprive me of making any slections in the dropdown further.

dont really understand why this problem is occuring. I am populationg my drop down in wdDoInit itself. So it is expected to retain the value.

Regards,

Vivek

Former Member
0 Kudos

Hi

have you created simpletype or populating the dropdown from database?

could you be specific in where you have the dropdown, how do you populate it

Regards,

Praveen

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Can u give me the code so that i can see what is the problem. Have u writen the code in the Event select() method of the dropdown for populating in the table. If u are populating using code in the wdDoInit() only once the values get displayed. If u use DD by index it will work in the init method().Otherwise use simple types and bind the values in the selected key property of DD by key .

Regards ,

Vijayakhanna Raman

Former Member
0 Kudos

Hello,

The drop down by key is in the table toolbar and i am statically populating it in the wdDoInit method as follows:

IWDAttributeInfo attributeInfoShow = wdContext.nodeKFMUI().getNodeInfo().getAttribute("show");

ISimpleTypeModifiable showList = attributeInfoShow.getModifiableSimpleType();

showList.setFieldLabel("Show");

IModifiableSimpleValueSet valueSetShow = showList.getSVServices().getModifiableSimpleValueSet();

valueSetShow.put("A", "AText");

valueSetShow.put("N", "NText");

valueSetShow.put("M", "MText");

valueSetShow.put("C", "CText");

Regards,

Vivek

vijayakhanna_raman
Active Contributor
0 Kudos

Hi Vivek,

check with the code example of key binding at runtime in this link and dont worry about the ui element there. And let me know again if u get the same problem

http://help.sap.com/saphelp_nw04/helpdata/en/86/16e13d82fcfb34e10000000a114084/frameset.htm

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

(to kushagra)

Please don't suggest such a "nonsense".

Armin

Message was edited by: Armin Reichert

Former Member
0 Kudos

Thanks Vijaya,

I forcefully set the value of the context attribute bound to the drop down's selected key property to the key value chosen in the drop down by storing it in a static variable. This has finally worked. Though I understand, its not a good solution and is just a work around, still this has solved my problem for the time being.

Thank you everyone for all your inputs.

Best Regards,

Vivek

Former Member
0 Kudos

Hi,

What does node KFMUI have. Are u using the same node for populating the table..

Whats its cardinality ? Can u show the onSelect code.. Is there a chance that you are repopulating this node using setter methods once a selection in the dropdown is made..

Regards

Bharathwaj

Former Member
0 Kudos

Please post how you have bound the properties of the drop-down list and how the context structure looks like.

Using static variables in a view controller will not work.

Armin

Former Member
0 Kudos

Hello Bharathwaj,

You are right. On the onSelect code of this drop down, I am repopulating this node using setter methods. Do you think this may lead to no display in the dropdown, once the table gets populated.

Best Regards,

Vivek

Former Member
0 Kudos

Hi Armin,

The context structure is as follows:

Node=> KFMUI

Recursive node=> RecKFMUI

attr=>show (this is bound to dropdown properties)

attr=>some other attributes specific to table

This is basically a hierarchical list.

In View controller:

I have declared a global static string as sShowStat.

In the onSelect code for dropdown "show", I set sShowStat to the key value of the selected entry in the drop down.

Then, I create an element for KFMUI (the usual creation of elements in order to populate the hierarchical list) and set the value of currentKFMUIElement's show attribute to sShowStat. sShowStat being attached to the selectedKey property of the dropdown, retains the value selected in the display.

Best Regards,

Vivek

Former Member
0 Kudos

To which context attribute did you bind the "selectedKey" property?

Is this attribute changed by the action handler of the drop-down list? (Are you modifying the context structure in some way such that this attribute looses its value?)

If not, this attribute should keep its value and the drop-down list should show the corresponding entry as its selection.

If this is not the case, open an OSS message.

The event "onSelect" has a parameter "key" that gives you the new selected key. To access this value in the action handler, implement a parameter mapping to an action parameter.

In any case, remove the static variable.

Armin

Message was edited by: Armin Reichert

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Garg,

Could you please post your "onAction" event of your dropdown?

Warm Regards,

Bala

Former Member
0 Kudos

hi vivek,

please post the code of wdDoModifyView() and onselect(). i think problem resides somewhere in these two methods only.

though my earlier suggestion deprive from further dropdown selection but u can work out by creating another button "new selection" and inside that method change the value of j to other than 1 say 2...thatway wddomodify method will be called and now use the condition to change the eanabling <b>true</b>.the dropdown will be enabled again.

but this is not the best solution,i know. so better if u can show the code.

Regards

kushagra

Former Member
0 Kudos

Hi vivek,

check the simple type binded to the drop down has both

value and text since in the drop down value get populated and when selected text is displayed.

And if this is not ur problem be more specific about the problem u have.

Check to this link also.

http://help.sap.com/saphelp_erp2005/helpdata/en/9f/656442a1c4de54e10000000a155106/frameset.htm

Regards,

Praveen