on 03-20-2009 10:19 AM
Hi all,
I have a table on my webdynpro screen with three columns and two rows of data.
Out of the one column is a drop down. This drop down is binded to a simple type string variable in the context. And this simple type contains two values.
For eg
1)Text1
2) Text2
Now my requirement is that when i push a button, i need to have these two values in two respective context variables so that i can use it later in a different screen.
Actually this field in drop down is a user field to which when dynamically set the variables will be available for setting a UWL task dynamically.
What should be my code to achieve the above?
Thnks
There is a property called 'selectedKey' for the dropdownbyKey UI element. Bind it to a context attribute of type string. This selectedKey determines the value from a value set. (The value which you select from the DropDownByKey will get saved in this context).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you not bind the selected keys of both the drop downs to separate context variables?
Also there is an event which is triggered when the user selects a list entry from the dropdown list box. You have the option of handling the event "onSelect" (i.e, if there are set of things that you wish to perform on selection).
For this event:
Event Parameter = key (Key of the selected entry)
Type = String
Hi Anagha,
Drop Down belongs to a table.
So virtually it means there is only mean one table drop down at design time. So at design time i can bind it to only one context variable.
Yes the 'onSelect' event is there.
Actually i have a buttton too. My situation is such that in my button action needs to give me selected values from the two drop downs (in two data rows).
This can happen only at runtime.
Is it so that i can loop around the table, and refer to a row using a row key and then select the context variable by referring to drop down element of that row?
Hi,
In the onAction of the button, implement the below given code.
int j = wdContext.nodeVn_table().size();
for (int i=0 ; i< j; i++ )
{
IPrivate< >View.IVn_tableElement elem = wdContext.nodeVn_table().getVn_tableElementAt(i) ;
String colmn = elem.getVa_<dropDownAttr>();
wdComponentAPI.getMessageManager().reportSuccess(colmn);
}
Here i am printing the values selected in the dropdown.
Regards,
Jithin
Hi Yigesh,
Very easy code, check this out..
As you have a attribute named let say : Owner which has the dropdown (I have taken the reference from your earlier post) and the node name as ActivityTable.
You you just need to do this:
int size = wdContext.nodeActivityTable().size();
String valueOwner = null;
for (int i = 0; i < size; i++) {
IActivityTableElement activityEle = wdContext.nodeActivityTable().getActivityTableElementAt(i);
valueOwner = activityEle.getOwner();
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("value of row" +i + "=" +valueOwner);
I hope this helps!!
Thanks and Regards
Praevsh
Hi Pravesh,
Thanks a lot for your reply. If i get the understanding of code right
int size = wdContext.nodeActivityTable().size();
String valueOwner = null;
for (int i = 0; i < size; i++) {
IActivityTableElement activityEle = wdContext.nodeActivityTable().getActivityTableElementAt(i);
valueOwner = activityEle.getOwner();
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("value of row" +i + "=" +valueOwner);
Does size here mean = number of rows in the table row at runtime? Or is it number of attributes under node?
I guess it is number of row data at runtime
This means that we are looping throught whatever number of data rows in the table at then at each loop we are referring the owner column and retrieving the values?
Hi,
Yes it is number of rows. You have understood it corerctly. I hope this solves your issue.
Please note that whenever you want to check for the number of rows then you just need to calculate the size of the node which is binded to the table.
While iterating over the node you can get the elements of the node which corresponds to each row.
Therefore:
1st Element <-------> 1st Row
2nd Element <-------> 2nd Row
3rd Element <-------> 3rd Row
So if you want to know the attribute values of a particular row just get that element number and then get the valueof the attribute which you want. This is what your exact requirement was..
I hope this helps!!
Thanks and Regards,
Pravesh
Hi,
Could u pls share the soln wid me too..
Regards,
Malita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yogesh
Sorry for hijacking this thread, but I noticed in your opening post that you mentioned:
...for setting a UWL task dynamically.
I am looking for a way to create arbitrary UWL tasks from a Java web-dynpro application (when certain events occur in our application).
I've not had any luck with this yet... ([my previous thread|/message/6398613#6398613 [original link is broken]])
If you've managed to get this working, could you please share your solution?
It would be greatly appreciated.
Thanks
Kind regards,
Rudolf
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.