Вы находитесь на странице: 1из 3

Adding New Row to the Advanced Table in Programatical way

Adding New Row to the Advanced Table in Programatical way Step 1: Create sample page Step 2: Create one Advanced Table in that page Step 3: Setup the required properties for the page Step 4: Create on footer for the table, in that create one add table row button Step 5: Set the below properties to the Add Table Row button Insert Rows Automatically : False Step 6: Now in the process Request method add the below code public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); sampleAMImpl am = (sampleAMImpl)pageContext.getApplicationModule(webBean); am.invokeMethod("createInsert1"); OAAdvancedTableBean tableBean = (OAAdvancedTableBean)webBean.findIndexedChildRecursive("AdvancedTableBean1"); System.out.println("Advanced Table Bean id--->"+tableBean); OATableFooterBean footerBean = (OATableFooterBean)tableBean.getFooter(); System.out.println("TableFooter bean-->"+footerBean); if(footerBean!=null) { OAAddTableRowBean addTableRowBean = (OAAddTableRowBean)footerBean.findIndexedChild("addTableRow1"); System.out.println("Add Table Row Bean id----->"+addTableRowBean); // Add 5 rows everytime add row button is clicked addTableRowBean.setText("Add 1 Rows"); addTableRowBean.setRows(1); // Handle add row insertion yourself addTableRowBean.setAttributeValue(AUTO_INSERTION, Boolean.FALSE); } } Step 7: In AMImpl Class write the below Code public void createInsert1() { OAViewObject vo =getInsertVO1(); if (!vo.isPreparedForExecution()) { vo.executeQuery();

} } Step 8: Now in the process Form Request method add the below code public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAAdvancedTableBean tableBean = (OAAdvancedTableBean)webBean.findIndexedChildRecursive("AdvancedTableBean1"); System.out.println("Advanced Table Bean id--->"+tableBean); OATableFooterBean footerBean = (OATableFooterBean)tableBean.getFooter(); System.out.println("TableFooter bean-->"+footerBean); if(footerBean!=null) { OAAddTableRowBean addTableRowBean = (OAAddTableRowBean)footerBean.findIndexedChild("addTableRow1"); System.out.println("Add Table Row Bean id----->"+addTableRowBean); if ((tableBean.getName(pageContext).equals(pageContext.getParameter(SOURCE_PARAM))) && (ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))) { System.out.println("Add Another row is pressed"); sampleAMImpl am = (sampleAMImpl)pageContext.getApplicationModule(webBean); am.invokeMethod("createAnotherRow1"); System.out.println("Action over"); } } Step 9: In Am Impl Class write the below Code public void createAnotherRow1() { InsertVOImpl studVo = getInsertVO1(); // StudentDetailsVOImpl studVo = getStudentVO1(); System.out.println(" vo class statement"); InsertVORowImpl studrow = (InsertVORowImpl)studVo.createRow(); System.out.println(" vo row impl statement"); studVo.last(); System.out.println("vo.last method"); studVo.next(); System.out.println("vo.next method"); studVo.insertRow(studrow); //'ABC' is HardCod value inserted based on the requirement in this example System.out.println("insert row method"); studVo.setCurrentRow(studrow);

System.out.println("current row method"); studrow.setNewRowState(Row.STATUS_INITIALIZED); System.out.println("Initialized method"); } Step 10: Now Run the page and check the functionality of Add Another Row.

Вам также может понравиться