on 10-13-2005 7:44 PM
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
Bind property "selectedKey" to a context attribute and get the selected key from there.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Armin,
Thanks for your response again. Right now in my project I am not using the staticly referenced UI element, I have created the DDK(Say ID=DDKUI) and did bind it to a value attribute(ShipTo is created and is of type simpletype) at design time but populating the value attrib node dynamically. Now I can access the user selected key by calling wdContext().currentContextElement().getShipTO().
This is how I have been doing it from the past few years.
Suppose I ve created the DDK & bound it to a value attribute dynamically. Two ways of getting the user selected value is
1. DDKObj.getSelectedKey() according to WD standards I would only be able do it in wdModifyView()
2. wdContext.currentContextElement().getAttributeAsText("theKey"). Here the key is the same as the one used in
DDKObjbindSelectedKey("theKey"). But the 2nd one returns null.
let me know if I am missing anything here.
will be looking for your response.
Thanks
Hi Yasu,
Please check if you are populating the attribute properly, with something like:
final IModifiableSimpleValueSet ValueSet= wdContext.getNodeInfo().getAttribute("<attribute_name>").getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
ValueSet.put(<key>,<value>);
The way of accessing the slectedKey for a dropdown doesn't change for dropdowns created dynamically. All that matters is if the <b>attribute</b> has been <b>created</b> at runtime. If so, you can acces the selected key as :
wdContext.currentContextElement().getAttributeValue("<name of your attribute>");
If you have created the attribute at design time, you can acces the selected value just like :
wdContext.currentContextElement().get<name of your attribute>();
Hope this helps,
Best Regards,
Nibu.
Hello Wilson,
Thanks for the response. As mentioned in my previous message I get a null value for the wdContext.currentContextElement().getAttributeValue("<name of your attribute>");
The only difference is that I used wdContext.currentContextElement().getAttribute"AsText"("<name of your attribute>");
-yasu
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.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.