on 09-07-2006 8:36 AM
Hi
I want to prompt a confirmation Dialog, before deleting from a table,
with yes,no,cancel options.
Then I created 3 event handlers
1.EmpRemove-parameter is 'cosid'
code:
public void EmpRemove(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String consid )
{
try
{
int n=stmt.executeUpdate("delete SaConsultantMaster where ConsultantId='"consid"'");
wdThis.showDialog("The Details of the consultant Are removed !!!");
wdThis.EmpReset();
}
catch(Exception e){}
}
2.No
public void No(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{}
3.Cancel
public void Cancel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{}
in my Action coding:
I wrote.
String Message="Do u want to Remove The Consultant "empid" ??";
IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();
com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent1=null;
wdThis.EmpRemove(wdEvent1,empid);
IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow( Message, controllerInfo.findInEventHandlers("EmpRemove"), "Yes");
dialog.addChoice(controllerInfo.findInEventHandlers("No"),"No");
dialog.addChoice(controllerInfo.findInEventHandlers("Cancel"),"Cancel");
dialog.open();
but the problem is
Before clicking the choice, itself the record is getting deleted.
If i click yes/No/Cancel, the action in event handler empremove is executing.
And when passing parameters to eventhandler, what should i give for 'Event' parameter?
can anybody help me..
Thanks in advance.
Smitha
Hi
remove the statement wdThis.EmpRemove(wdEvent1,empid);
from your Action coding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Smitha,
in your action coding you call your EventHandler EmpRemove before showing the dialog:
-
wdThis.EmpRemove(wdEvent1,empid);
IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow( Message, controllerInfo.findInEventHandlers("EmpRemove"), "Yes");
---
So remove the line "wdThis.EmpRemove(wdEvent1,empid);" and let the EventHandler do his work when the user confirms the deletion. Probably you should als check whether and how your ConsultantId is transfered as parameter. Think about removing it from the EventHandler and getting the selection straight out of the table.
HTH
Tina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.