This discussion is archived
1 Reply Latest reply: Mar 4, 2010 11:52 PM by Frank Nimphius RSS

JDeveloper 11g Release 1 - Inserting a new Row (Without createInsert)

599748 Newbie
Currently Being Moderated

I'm using JDeveloper 11gr1 to insert a new row into a table of data. If I make use of the createInsert functionality then the new row is added to the top of the table. In some cases this would be OK but in this instance I am adding lines to an invoice so the order is important. The method I am using is as follows:
  public void createNewInvoiceLine(ActionEvent actionEvent) {
    //create new row in iterator
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iteratorBinding = (DCIteratorBinding) bindings.get("EditPurchaseInvoiceItemsView1Iterator");
    RowSetIterator purchaseInvoiceRows = iteratorBinding.getRowSetIterator(); 
    Row newRow = purchaseInvoiceRows.createRow();
    int i = purchaseInvoiceRows.getRowCount();
    purchaseInvoiceRows.insertRowAtRangeIndex(i, newRow);
    //scroll to the new row
    RowKeySet selectedRows = this.getInvoiceLinesTable().getSelectedRowKeys();
    Object key = selectedRows.iterator().next();
This code achieves almost all of the functioanlity I desire:

A) Inserting a new Row
B) Setting focus to the new Row
C) Scrolling the table if necessary

The only issue is that my table contains the following code:
<af:column headerText="#{bindings.EditPurchaseInvoiceItemsView1.hints.VatRateCode.label}"
                                 id="c8" filterable="false"
                                 sortable="false" width="50">
                        <af:inputListOfValues id="vatRateCodeId"
                                              popupTitle="Select: #{bindings.EditPurchaseInvoiceItemsView1.hints.VatRateCode.label}"
                          <f:validator binding="#{row.bindings.VatRateCode.validator}"/>
Something in the framework goes out of sync so that I cannot type values into my list of values fields. It is always correct for the first row (which is called using createInsert from a different page) but then any subsequent rows do not allow entry, when you type in the box the value immediately dissapears and I see the following message in the JDeveloper log
<FacesCtrlLOVBinding$ListOfValuesModelImpl><_getRowFromSelectedRowKey> ADFv: No row found for rowKey: [oracle.jbo.Key[]].
The message does not appear if the value is selected using the magnifying glass

Any help is greatly appreciated.
  • 1. Re: JDeveloper 11g Release 1 - Inserting a new Row (Without createInsert)
    Frank Nimphius Employee ACE
    Currently Being Moderated

    from a brief look at it, you don't scroll to the newly created table row but to the first selected row in the table component. This is a difference because the new row is created in the iterator, not the UI component. So you would need to change 2 things here

    1. the selected row in the table must match the newly created row in the binding (note that the table row is set using a List whereas the row in the binding is identified by a Key)

    2. You need to PPR update the table or have ChangeEvetPolicy on the binding set to PPR

    3. use (newRow.getKey().toStringFormat(true));



  • Correct Answers - 10 points
  • Helpful Answers - 5 points