Add the row at the end of ViewObject’s current RowSet in ADF

Sharing is Caring

Hello All, Hope that you are doing well. This post is about adding a row at the end of ViewObject’s current rowset without using a table or any other UI components binding. Here we use the last row index to insert the new row at the end of rowset.

Here I have a Department ViewObject (HR Schema), dropped as a table on the page and a button to add a new row, this button calls a method from the model using the binding layer of the ADF framework and that method inserts a new row at the end of current rowset, you can learn more about ADF bindings here

The code in AMImpl to add a row at the end of ViewObject’s current RowSet

     * Method to add row at the end of viewObject
    public void addRowAtEnd() {
        //Get ViewObject
        ViewObjectImpl deptVo = this.getDepartmentsVO1();
        //Get current data RowSetIterator
        RowSetIterator rsi = deptVo.getRowSetIterator();
        //Get last Row of current Iterator
        Row lRow = rsi.last();
        //Get index of the last row
        int lrIndex = rsi.getRangeIndexOf(lRow);
        //Create a new row
        Row nRow = rsi.createRow();
        //Initialize that row
        //Add row in last of current rowset
        rsi.insertRowAtRangeIndex(lrIndex + 1, nRow);
        //Set newly created row as current row


Bean Code to call the Model layer method using ADF bindings

Here you can see the method defined in the model layer is called using BindingContainer and OperationBinding. Here you can learn more about calling model level methods in the managed bean.

    /**Generic Method to get BindingContainer of current page,
    public BindingContainer getBindingsCont() {
        return BindingContext.getCurrent().getCurrentBindingsEntry();

 * Generic Method to execute operation
 * */
public OperationBinding executeOperation(String operation) {
OperationBinding createParam = getBindingsCont().getOperationBinding(operation);
return createParam;

/**Method to add new row
 * @param actionEvent
public void addNewRowAction(ActionEvent actionEvent) {

All done, Now run and check Application, Click on Add Row button and see that new row is added at the end of the table (at end of current rowset of viewObject).

row at the end of ViewObject's current RowSet

Cheers 🙂 Happy Learning

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *