Skip to main content

Posts

Showing posts from December, 2010

ADF 11g : How to control where a new row is inserted

On the JDeveloper forum a question was asked how to insert a new row in an ADF table after the selected row. Default behavior is insertion before the current row. In this short post I describe how to achieve this. In order to do this I create a custom method on the application module that takes the position (BEFORE or AFTER) as an argument. Based on this argument the new row is inserted at the appropriate position. public void createRow(String beforeOrAfter){ Row newRow = getJobsView1().createRow(); newRow.setNewRowState(Row.STATUS_INITIALIZED); //get instance of the above created view object ViewObjectImpl vo=getJobsView1(); // to insert row at the end of the table if (beforeOrAfter.equalsIgnoreCase("AFTER")){ vo.next(); vo.insertRow(newRow); } else { vo.insertRow(newRow); } } I publish the method, and drop it as a Button on the page. I copied the button so I have one for each option. <af:panelCollection