on 2007 Jul 10 12:54 PM
Hi,
I hav been wrote the following code in wddoinit method.
*data: lr_node_info type ref to if_wd_context_node_info,
lt_valueset type table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_node type ref to if_wd_context_node.
*
*lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
*lr_node_info = lr_node->get_node_info( ).
*
*
*clear: ls_valueset, lt_valueset.
*
*ls_valueset-value = 'key1'.
*ls_valueset-text = 'Male'.
*append ls_valueset to lt_valueset.
*
*ls_valueset-value = 'key2'.
*ls_valueset-text = 'Female'.
*append ls_valueset to lt_valueset.
*
*lr_node_info->set_attribute_value_set(
*exporting
*name = 'GENDER'
*value_set = lt_valueset ).
during runtime when i select radio button, its not selecting anything. still i need to write code at onaction button,. but i dont knw wat to wirte. could you guys please help me regarding this.
thanks in advance
Hi.
when you want to do some action when user selects an entry:
create the action for the onSelect event.
In the action you get the context element of the currenty selected entry like:
Data:
lr_element type ref to if_wd_context_element,
. ls_valueset type wdr_context_attr_value
lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
lr_element->get_static_attributes(
static_attributes = ls_valueset
).
Then you can do something with it.
If you want to have a button which perfroms some action regarding the current selection just craete an action for the button and in the action you can get the selected element like:
lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
lr_element = lr_node->get_element( ).
lr_element->get_static_attributes(
static_attributes = ls_valueset
).
Hope this helps,
Sascha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
No need to get confused.Please put the property for the Radio Button .. i mean the selected Key...For example in my case , i put the Key as 'X'..so when the contex attribute is 'X' ..the radio button will be selected.Also ..when you click on the radio button , the value of the context attribute will be set with 'X'.
Also you could use the code provided by Nithya to fetch the selected value.
Thanks
Anzy
Hi Anzy,
I hav followed the same which u mentioned above like,
i hav wrote the following code in doinit
method WDDOINIT .
data: lr_node_info type ref to if_wd_context_node_info,
lt_valueset type table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_node type ref to if_wd_context_node.
lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
lr_node_info = lr_node->get_node_info( ).
clear: ls_valueset, lt_valueset.
ls_valueset-value = 'key1'.
ls_valueset-text = 'Male'.
append ls_valueset to lt_valueset.
ls_valueset-value = 'key2'.
ls_valueset-text = 'Female'.
append ls_valueset to lt_valueset.
lr_node_info->set_attribute_value_set(
exporting
name = 'GENDER'
value_set = lt_valueset ).
endmethod.
and i wrote the following code in "onselect" event for radiobutton
method ONACTIONRBUTTON .
data: lr_node type ref to if_wd_context_node,
lr_elem type ref to if_wd_context_element,
item_gender type zaccount-gender.
lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
lr_elem = lr_node->get_element( ).
lr_elem->get_attribute(
exporting
name = 'GENDER'
importing
value = item_gender ).
endmethod.
even thogh its not working. wen i select the radio button, its not selecting.
wat to do
Hi,
I hav follwed the same which u mentioned.
i wrote the code for doinit, whcih i mentioned in my first thread.
i wrote the code "onselect" even for radio button as follow
method ONACTIONRBUTTON .
data: lr_node type ref to if_wd_context_node,
lr_elem type ref to if_wd_context_element,
item_gender type zaccount-gender.
lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
lr_elem = lr_node->get_element( ).
lr_elem->get_attribute(
exporting
name = 'GENDER'
importing
value = item_gender ).
endmethod.
even though its not selecting the radio button when i select.
wat to do
Hi Venkat,
I have tried out the code that I have given and it works fine for me.
Your UI element in the view should be a <b>RadioButtonGroupByKey</b>, not simply a RadioButton. The <b>selectedKey</b> property should be bound to the context attribute 'Gender'. I hope you know how to do that binding.
Now, my exact code is this:
<b>method WDDOINIT .</b>
data: lr_node_info type ref to if_wd_context_node_info,
lt_valueset type table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_node type ref to if_wd_context_node.
lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
lr_node_info = lr_node->get_node_info( ).
clear: ls_valueset, lt_valueset.
ls_valueset-value = 'key1'.
ls_valueset-text = 'Male'.
append ls_valueset to lt_valueset.
ls_valueset-value = 'key2'.
ls_valueset-text = 'Female'.
append ls_valueset to lt_valueset.
lr_node_info->set_attribute_value_set(
exporting
name = 'GENDER'
value_set = lt_valueset ).
<b>endmethod.</b>
I have defined an event 'Select' for the onSelect action of the radio button. The code inside my onSelect is:
<b>method ONACTIONSELECT .</b>
data: lr_node type ref to if_wd_context_node,
lr_elem type ref to if_wd_context_element,
item_gender type char01.
lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
lr_elem = lr_node->get_element( ).
lr_elem->get_attribute(
exporting
name = 'GENDER'
importing
value = item_gender ).
<b>endmethod.</b>
When I select 'Male', item_gender will have 'key1', and it will be set to 'key2' when I select Female. The context attribute 'gender' is of type char04.
Get back if you have any more issues.
Regards,
Nithya
Have you bound the selectedKey property of your radio button to your context attribute? In your onAction, you write this:
data: lr_node type ref to if_wd_context_node,
lr_elem type ref to if_wd_context_element,
item_gender type <data type of gender attribute>.
lr_node = wd_context->get_child_node( 'USER_GENERAL_INFO' ).
lr_elem = lr_node->get_element( ).
lr_elem->get_attribute(
exporting
name = 'GENDER'
importing
value = item_gender ).
The field item_gender will hold the selected key, i.e key1 or key2.
Regards
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
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.