Saturday, May 15, 2010

ADF:Bring a specific row in a VO to the top slot

Requirement
You have a view object populated with some rows.You want to put a specific row(identified by a PK attribute) at the top of the VO query collection.

Example
if(pEmpno != null){
Row foundEmpRow = empVO.getRow(new Key(new Object[]{pEmpno}));
if(foundEmpRow != null){
ViewObjectImpl empVOImpl = (ViewObjectImpl)empVO;
empVOImpl.getQueryCollection().remove(foundEmpRow);
empVOImpl.getQueryCollection().add(0, foundEmpRow);
}
}

No comments: