Friday 14 October 2011

Delete Operation in oaf...when we pressing the delete icon in the page


In the CO type the following:

//"delete" is the Event raised when you press the Delete Icon in Invoice
//Lines
//So check if the Delete icon has been pressed.

else if ("delete".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
{
//get the Unique Row Reference for the Row on which the Even has been
//generated.
String lineRefId = (String)pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable [] param={lineRefId};
//Call the AM method deleteInvoiceLine to delete the Invoice Lines
am.invokeMethod("deleteInvoiceLine",param);

}
In the AM type the following

//method in the AM
public void deleteInvoiceLine(String lineRefId){
//Find the LineVORowImpl using the Unique Row
// Reference
LineVORowImpl lineRow = (LineVORowImpl)findRowByRef(lineRefId);

lineRow.remove();

}
Finally commit to save the changes to the database

2 comments:

  1. Hi Santhosh,

    String lineRefId = (String)pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);

    This part of the line in my code is returning null when clicked on Delete button(Image style). Please let me know the alternatives for this.

    ReplyDelete