There are many ways to to create a new Row for the View Object
Firstly make sure that the View object can be Updated ( Based on Entity)
1- Operations
Operation Like Create , CreateInsert , CreateWithParams
here you can simply drag and drop from DataControl to Your Page or You can execute the operation in the code
for Example :
============================================================
ViewObject vo = ADFUtils.getAm().getCountriesView1();
BindingContainer bindings = getBindings();
// Create Operation
OperationBinding opCreate = bindings.getOperationBinding("Create");
// Commit Operation
OperationBinding opCommit = bindings.getOperationBinding("Commit");
// Delete Operation
OperationBinding opDelete = bindings.getOperationBinding("Delete");
// Create The Row
opCreate.execute();
// Create the RowImpl from Java Tab in VO
// this will be The Created Row
CountriesViewRowImpl row = (CountriesViewRowImpl)vo.getCurrentRow();
//Set The Data
row.setCountryId("105");
row.setCountryName("Abcd");
row.setRegionId(100);
// Save - Commit All Updates
opCommit.execute();
// Delete current row
opDelete.execute();
============================================================
2- Coding
BindingContainer bindings = getBindings();
Row newRow = vo.createRow();
newRow.setAttribute("CountryId", "105");
newRow.setAttribute("CountryName", "Abcd");
vo.insertRow(newRow);
// Commit Operation
OperationBinding opCommit = bindings.getOperationBinding("Commit");
// Save - Commit All Updates
opCommit.execute();
// Delete current row
vo.getCurrentRow().remove();
No comments:
Post a Comment