Skip to Content
avatar image
Former Member

get the selected key of a dynamic dropdownbykey ui element

Hello

I ve craeted a dynamic DropDownByKey UI element and I bound it to a context attribute. The dropdown works fine with dynamic values. Now I want to get the user selected key of the dropdownbykey UI element.

Any help will be apprecaite very much and rewarded as well 😊

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 13, 2005 at 06:47 PM

    https://media.sdn.sap.com/javadocs/NW04/SP12/webdynpro/com/sap/tc/webdynpro/clientserver/uielib/standard/api/IWDAbstractDropDownByKey.html

    Bind property "selectedKey" to a context attribute and get the selected key from there.

    Armin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 13, 2005 at 11:12 PM

    Hello Armin,

    Thanks for your response. Your api link certainly helped me out. I used the static reference of the dropdown UIelement. Is there any other api through which I can access the UIelements of the view directly.

    Will be looking forward for your response.

    Thanks 😊

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Yasu,

      Can you please confirm the following :

      1) Are the values being displayed properly in the dropdown?

      2) Is the attribute that you use, being created dynamically?

      As you wrote,if you are binding the 'SelectedKey' of the dropdown as 'DDKObj.bindSelectedKey("theKey");' and if you are getting the values properly, then on selecting a value from the dropdown, the statement 'wdContext.currentContextElement().getAttributeAsText("theKey")' should return a proper value unless you initialize the attribute in wdDoModify(). If you are accessing this attribute in wdDoModify(), please check if you are setting any values for this attribute outside the 'if(firstTime){ }' block.

      The statements

      wdContext.currentContextElement().getAttributeAsText("theKey");

      and

      wdContext.currentContextElement().getAttributeValue("theKey");

      will return you the same data, the first being a string representation of the key value and the second an Object representation.

      Still if you have this problem, paste your relevant code here; someone among us might be able to help you !

      Best Regards,

      Nibu.