cancel
Showing results for 
Search instead for 
Did you mean: 

how to make the checkboxes selected

Former Member
0 Kudos

Hi All,

How to make the check box selected that was already selected by the user. That is, if suppose i have selected checkboxes L1 and L2. When i come to the same screen later i want the checkboxes to be marked automatically that i selected before. Please experts help me over come this issue.

Accepted Solutions (1)

Accepted Solutions (1)

former_member463524
Contributor
0 Kudos

Hi,

1. Define the context in component controller and map it to the view or you can use the context in view itself

2. While moving from view to next view copy value of the check box to the global variable,

selected means X otherwise null.

3. Write the code in modifyview for below,

using set_attribute assign value of global variable.

Following is the difference b/w init and modifyview,

init will be called only one time in the lifetime of the component.

wddoinit( ) is the first method processed in the controlleru2019s lifetime. It is only

called once in the controlleru2019s lifecycle. All your initialization code should

go here since this method is called immediately after the controller has been

instantiated.

The only method that allows to access the UI element hierarchy is the viewu2019s

wddomodifyview( ) method. The interface parameter VIEW is a reference to the

UI element hierarchy; the FIRST_TIME parameter can be used to find out if this

method has been previously processed in the view controlleru2019s lifecycle. This

method can be used to manipulate the UI element hierarchy dynamically.

Hope this solves your issue.

Regards,

Meera

Former Member
0 Kudos

Hi meera,

Thanks for u reply, I understood wat u said but i dont know how to set the attribute value can u post me some code for that if u can.

Answers (2)

Answers (2)

former_member463524
Contributor
0 Kudos

Hi ,

As Shaira said, map the context to the checked property, if the binded value is from the compnent controller context then

it will be available for the entire life time, using set attribute method make the field as marked, you can write the code in

WDOINIT or you can write in MODIFY.

Regards ,

Meera

Edited by: Meera Chandrasekeran on Apr 19, 2011 12:32 PM

Former Member
0 Kudos

Hi thanks for u r reply. The thing is i have written code in the init method and binded the context with the chechbox. All is fine. I am able to check the boxes during run time everything is fine. when i come to the page next time i should have the check boxes selected which i already selected.How to do that. Please reply.

Former Member
0 Kudos

Hi vadiv,

Your checkbox contains two types of value 'X' and ' '. Based on these value it it's status get updated i.e whether it is checked or not.

So you make a context node in componentcontroller ( because this is visible to every view ) and create a attribute of type WDY_BOOLEAN.

Now in a particular view layout where you are implementing checkbox go to the checkbox and bind it's checked property to the context node attribute.

Now whenever user will select the checkbox it will be updated with the value and this will remains while navigation also.

also checked the thread:-

[How to use Check box|;

Reply in case of any query.

regards,

Monishankar C

Former Member
0 Kudos

Hi Monish,

Thanks for you reply. What you said will it work for checkbox group. I have done wat you have said for a single check box and did some abap true or false based on whether it is checked or not. But my requirement is how to make the check boxes selected that i selected already, when i visit a page t

former_member389677
Active Participant
0 Kudos

Hi,

For your checkbox you have an attribute in the context that bind to the Checked property. You can write code in WDDOINIT to initialize the value to checked .

Regards ,

Shaira.