Hi,
I display a table based on an iterator binding executable. I click on a row, then on a button outside the table that positions the iterator at the end, add a new row and navigate to a new fragment:
private void createRow(String iteratorName) {
DCIteratorBinding binding = ADFUtils.findIterator(iteratorName);
//access the underlying RowSetIterator
RowSetIterator rsi = binding.getRowSetIterator();
//get handle to the last row
Row lastRow = rsi.last();
//obtain the index of the last row
int lastRowIndex = rsi.getRangeIndexOf(lastRow);
//create a new row
Row newRow = rsi.createRow();
//initialize the row
newRow.setNewRowState(Row.STATUS_INITIALIZED);
//add row to last index + 1 so it becomes last in the range set
rsi.insertRowAtRangeIndex(lastRowIndex + 1, newRow);
//make row the current row so it is displayed correctly
rsi.setCurrentRow(newRow);
}
On that fragment I have a Cancel link that removes the added row, and set the current row to null, so no row is selected.
private void cancelCreateRow(String iteratorName) {
DCIteratorBinding binding = ADFUtils.findIterator(iteratorName);
RowSetIterator rsi = binding.getRowSetIterator();
Row currentRow = rsi.getCurrentRow();
if (currentRow.getAttribute("Id") == null) {
rsi.removeCurrentRow();
}
rsi.setCurrentRow(null);
}
The issue is that the last row is still selected. What am I doing wrong?