on 10-02-2007 4:47 PM
Hi All,
I have small requirement in Web Dynpro. I have to display radio button as a column in table and user can only select one radio button (i.e. User can enter multiple phone numbers in a table but he can only select one number as default). How to do this functionality? If anybody knows, please advice me.
If anybody has sample code that would be great help.
Thanks & Regards,
IA Kumar.
Hi Anil,
You need to use KEY_TO_SELECT and SELECTED_KEY properties of the radio button .
Documentation of above attributes ( help.sap.com )
keyToSelect-Value of the key used to select this RadioButton.
selectedKey-Path to the context attribute that stores the selected key.
For a radio button to work in a table, there should be a key which differentiates the each row from other.
<b>Key_to_select</b> shoulb be bound to above key which exists in the structure used to display the table.
Have an attribute outside of the above node ( having cardinality of 0..n or 1..n ). Data element of this attribute should be same as the above key element's attribute.
Bind the SELECTED_KEY property to this attribute. So, if any radio button is selected value of the row's key will be copied to the attribute which is bound to SELECTED_KEY property.
EG:
Table is having 5 rows, lets take each row's primary key is row number which should exist in the structure .
Now user selected second row, then context attribute which is bound to SELECTED_KEY will be populated with value 2( which is key of the second row ).
while updating the data of the table, get the value of the SELECTE_KEY attribute and depending on that set the flag for for that row or do any logic that needs to be done.
While displaying the data, get the key of the row for which radio button needs to be checked (selected ), populate that key in SELECTED_KEY's attribute. Automatically, webdynpro wll select the corresponding row's radio button.
Hope this will help you.
Thanks,
Prashanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anil,
To which attribute KEY_TO_SELECT property is bound?. Here, it seems it is bound to an attribute which is of type XFIELD. This key should be bound to an attribute which acts like a primary key in the table then only it rerurns the key of the row which is selected to SELECTED_KEY attribute. Depending on the key Selected you have to set the true flag to corresponding row.
thanks,
Prashanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anil,
It is not possible to have multiple radio buttons in a single cell of a column. You should use a drop down instead.
Regards,
Neha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.