on 10-13-2005 4:26 PM
Hi!
I unfortunately have a problem with checkboxgroups. For the action onToggle I mapped the Parameters in wdDoModifyView() the following:
if (firstTime) {
// Get references to all checkboxgroups
IWDCheckBoxGroup cg1 = (IWDCheckBoxGroup) view.getElement("CheckBoxGroup1");
// Link the client-side event parameter 'index' to the server-side action parameter 'cgindex'
cg1.mappingOfOnToggle().addSourceMapping("index", "cgindex");
cg1.mappingOfOnToggle().addSourceMapping("checked", "cgchecked");
// Hardcode the checkboxgroup name for each action parameter
cg1.mappingOfOnToggle().addParameter("cgname", cg1.getId());
}
In my onToggle action, how can I find out now whether the checkbox at index cgindex is checked??
Would be great if you can help me with that.
Bye,
Timo
The mapped parameter 'checked' will give you what the checked value of the toggled checkbox has. It will be a boolean of what the new entry is.
Cindy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Timo,
Yes, the checked value is for the checkbox indicated by the index that the user just toggled.
You might want to look at the UI element guide for CheckBoxGroup at: http://help.sap.com/saphelp_nw04/helpdata/en/0a/16e94d251a164392f3a3415c6d643a/frameset.htm
Cindy
Sorry for my poor English ><
Step1. Create a Value Node under Root Element
Name : CheckBoxGroup
cardinality : 0 .. n
selection : 0 .. n
Context
|--- CheckBoxGroup
Step2. Create a context element under CheckBoxGroup
Name : CKItem ( type : String )
Context
|--- CheckBoxGroup
|---- CKItem
Step3. Put an CheckBoxGroup UI object on Layout .
Property colcount : 3 ( for example )
texts : CheckBoxGroup.CKItem
Step4. Create a new Action named "ChkGroupToggled"
with two parameter
1. cgIndex ( int )
2. cgChecked ( boolean )
Step5. Code implementation
public static void wdDoModifyView(IPrivateTest941124View wdThis, IPrivateTest941124View.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
try{
if (firstTime) {
IWDCheckBoxGroup cg1 = (IWDCheckBoxGroup) view.getElement("CheckBoxGroup1") ;
cg1.mappingOfOnToggle().addSourceMapping("index", "cgIndex") ;
cg1.mappingOfOnToggle().addSourceMapping("checked", "cgChecked") ;
}
}
catch( Exception e ){
}
//@@end
}
Step6. Code implementation
public void onActionChkGroupToggled(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, int cgIndex, boolean cgChecked )
{
//@@begin onActionChkGroupToggled(ServerEvent)
try{
// Context Element "Info" is just for debug prupose only
wdContext.currentContextElement().setInfo( cgIndex + " : " + cgChecked ) ;
}
catch( Exception e ){
}
//@@end
}
Step7. Add an UI object ( ex : TextEdit ) on Layout and bind the "value" parperty with context element "Info"
Step8. Bind action with onToggle Event in the UI element created in Step3.
Step9. Deploy and Run your webdynpro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.