Tuesday, 14 July 2015

ADF: Insert row at the bottom of table



In most scenarios there is a requirement to insert row at bottom of table.
Lets see how can we achieve this.

Step 1-  Generate VOimpl class of your View Object.

Step 2- Go to VOimpl class and add below code

        @Override
    public void insertRow(Row row) {
        //go to the end of Rowset if it has rows
        Row lastRow = this.last();
        if (lastRow != null) {
            //insert new row at the end and make it current
            int indx = this.getRangeIndexOf(lastRow) + 1;
            this.insertRowAtRangeIndex(indx, row);
            this.setCurrentRow(row);
        } else { // empty Rowset
            super.insertRow(row);
        }
    }

In this way you can insert row at the bottom of table.


Hope this will be helpful.

Ravi

1 comment: