Hi Friends this is about creating Advanced Table in Advanced Table.
My Friend ravi provided some of the impotent message for creating this functionality.
Thanks Ravi
For developing above page we need to create Association , View Link ,Entity Objects,View Objects, and Application Module.
View Part:
First create a advanced table and assign properties of advanced table:
Next step :create a detail Advanced Table and assign the properties of detail table:
view Part is completed.
Coding Part:
Create a controller and create a custom method for adding child row in detail table.
public void addRowIntoDetail(OAPageContext pageContext, OAWebBean webBean,
OAApplicationModule am, int iterator) {
// get a handle to inner table
RowSet innerRowSet = null;
int counter = 0;
int rowCnt = -1;
OARow row = null;
String subLrNo = null;
String LrLineId = null;
OAViewObject LrLinesVO =
(OAViewObject)am.findViewObject("ViewObjectName");
ArrayList subLrDtls = new ArrayList();
OAAdvancedTableBean innerTable =
(OAAdvancedTableBean)webBean.findChildRecursive("region3");
// create an enumerator
OAInnerDataObjectEnumerator enum1 =
new OAInnerDataObjectEnumerator(pageContext, innerTable);
while (enum1.hasMoreElements()) {
innerRowSet = (RowSet)enum1.nextElement();
// get all rows
Row[] rowsInRange = innerRowSet.getAllRowsInRange();
System.out.println(" Inner Table Fetched Row Count :" +
innerRowSet.getFetchedRowCount());
if (iterator != -1) {
if (counter == iterator)
break;
}
counter++;
}
if (innerRowSet.getAllRowsInRange().length < 10 )
rowCnt = innerRowSet.getAllRowsInRange().length;
else
rowCnt = innerRowSet.getAllRowsInRange().length - 1;
OARow newChallanRow = (OARow)innerRowSet.createRow();
innerRowSet.insertRowAtRangeIndex(rowCnt,newChallanRow);
newChallanRow.setNewRowState(Row.STATUS_INITIALIZED);
}
call the above method in process request and execute Master View object.
in Process form requset:
OAApplicationModule am=(OAApplicationModule)pageContext.getRootApplicationModule();
String source = pageContext.getParameter(SOURCE_PARAM);
String event = pageContext.getParameter(EVENT_PARAM);
String innerTab = null;
String level = null;
int hLvl = -1;
int Startindex = source.indexOf("___");
if (Startindex != -1) {
innerTab = source.substring(0, Startindex);
level = source.substring(source.length() - 1, source.length());
hLvl = Integer.parseInt(level);
System.out.println("Inner Tab is " + innerTab + " level is :" +
level);
}
if ("addRows".equalsIgnoreCase(event) &&
"region3".equalsIgnoreCase(innerTab)) {
OAAdvancedTableBean innerTable =
(OAAdvancedTableBean)webBean.findChildRecursive("child region");
// create an enumerator
OAInnerDataObjectEnumerator enum1 =
new OAInnerDataObjectEnumerator(pageContext, innerTable);
// In case you want to add new rows in this RowSet, you can do the same
RowSet innerRowSet = (RowSet) enum1.nextElement();
OARow newRow = (OARow) innerRowSet.createRow();
innerRowSet.insertRow(newRow);
}
Just save and run your page.
My Friend ravi provided some of the impotent message for creating this functionality.
Thanks Ravi
For developing above page we need to create Association , View Link ,Entity Objects,View Objects, and Application Module.
View Part:
First create a advanced table and assign properties of advanced table:
Next step :create a detail Advanced Table and assign the properties of detail table:
view Part is completed.
Coding Part:
Create a controller and create a custom method for adding child row in detail table.
public void addRowIntoDetail(OAPageContext pageContext, OAWebBean webBean,
OAApplicationModule am, int iterator) {
// get a handle to inner table
RowSet innerRowSet = null;
int counter = 0;
int rowCnt = -1;
OARow row = null;
String subLrNo = null;
String LrLineId = null;
OAViewObject LrLinesVO =
(OAViewObject)am.findViewObject("ViewObjectName");
ArrayList subLrDtls = new ArrayList();
OAAdvancedTableBean innerTable =
(OAAdvancedTableBean)webBean.findChildRecursive("region3");
// create an enumerator
OAInnerDataObjectEnumerator enum1 =
new OAInnerDataObjectEnumerator(pageContext, innerTable);
while (enum1.hasMoreElements()) {
innerRowSet = (RowSet)enum1.nextElement();
// get all rows
Row[] rowsInRange = innerRowSet.getAllRowsInRange();
System.out.println(" Inner Table Fetched Row Count :" +
innerRowSet.getFetchedRowCount());
if (iterator != -1) {
if (counter == iterator)
break;
}
counter++;
}
if (innerRowSet.getAllRowsInRange().length < 10 )
rowCnt = innerRowSet.getAllRowsInRange().length;
else
rowCnt = innerRowSet.getAllRowsInRange().length - 1;
OARow newChallanRow = (OARow)innerRowSet.createRow();
innerRowSet.insertRowAtRangeIndex(rowCnt,newChallanRow);
newChallanRow.setNewRowState(Row.STATUS_INITIALIZED);
}
call the above method in process request and execute Master View object.
in Process form requset:
OAApplicationModule am=(OAApplicationModule)pageContext.getRootApplicationModule();
String source = pageContext.getParameter(SOURCE_PARAM);
String event = pageContext.getParameter(EVENT_PARAM);
String innerTab = null;
String level = null;
int hLvl = -1;
int Startindex = source.indexOf("___");
if (Startindex != -1) {
innerTab = source.substring(0, Startindex);
level = source.substring(source.length() - 1, source.length());
hLvl = Integer.parseInt(level);
System.out.println("Inner Tab is " + innerTab + " level is :" +
level);
}
if ("addRows".equalsIgnoreCase(event) &&
"region3".equalsIgnoreCase(innerTab)) {
OAAdvancedTableBean innerTable =
(OAAdvancedTableBean)webBean.findChildRecursive("child region");
// create an enumerator
OAInnerDataObjectEnumerator enum1 =
new OAInnerDataObjectEnumerator(pageContext, innerTable);
// In case you want to add new rows in this RowSet, you can do the same
RowSet innerRowSet = (RowSet) enum1.nextElement();
OARow newRow = (OARow) innerRowSet.createRow();
innerRowSet.insertRow(newRow);
}
Just save and run your page.