hi All,
I have the below code for a view object shown as af:table. It is supposed to show what rows I have in the table.
I can see data in the table but I can't access them via the below snippet in the application module java class.
What is wrong? Event if we assume that getRowSetIterator gets data from cache (which I really don't what cash is in the class diagram here)
| public void updateAssetOwner2(){ |
| RowSetIterator rs = getAstExchangeItemsVO().getRowSetIterator(); |
| System.out.println("Hello there"); |
| rs.reset(); |
| while (rs.hasNext()){ |
| |
| System.out.println("Id: " + rs.getCurrentRow().getAttribute("Id")); |
| rs.next(); |
| } |
| } |
The rows are created with the below code:
| public String addNewEchangeItemRow(Object newExchangeId, String Id, String OwnerId) { |
| _logger.info("addNewEchangeItemRow start"); |
| |
| DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry(); |
| |
| ViewObjectImpl astExchangeItemsVO = getAstExchangeItemsVO(); | |
| RowSetIterator rsi = astExchangeItemsVO.findRowSetIterator("AstExchangeItemsVOIterator"); |
| |
| if (rsi == null) |
| rsi = astExchangeItemsVO.findRowSetIterator(null); |
| |
| //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); |
| |
| |
| // setup new attributes |
| newRow.setAttribute("AsetId", Id); |
| newRow.setAttribute("PrsnId", OwnerId); |
| newRow.setAttribute("Id", newExchangeId); |
| |
| |
| |
| //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); | |
| _logger.info("addNewEchangeItemRow end"); |
| return null; |
| } |
By the time I call the first snippet, the new rows haven't been committed yet. So, I am curious to find out why I can't access the UI component's data using getRowSetIterator.
Please let me know if you have any clue.
Thanks in advance,
Jake