Bhushan
Bhushan

Reputation: 6181

adf inline editing SelectionListener for first row

I have a fusion web applications in oracle adf (jdeveloper).

In which I have a table with inline editing. In which I want to allow autocommit if user leaves the current row. So if user navigated to another row then changes made in the previous row must be saved automatically.

For this I have set SelectionListener property of table to:

#{DisDocT.myCustomSelectionListener}

And I have written the code:

public void myCustomSelectionListener(SelectionEvent selectionEvent)
{
    System.out.println("In myCustomSelectionListener");
    if(isDirty()) {
        cb4_action();//Commits the changes
    }
    MyUtils.invokeMethodExpression("#{bindings.MyView2.collectionModel.makeCurrent}", Object.class, SelectionEvent.class, selectionEvent);
}

Above code works fine if table has multiple rows to iterate. But in the case when table has only one row, or newly created row then it doesn't works.

Any suggestion will be appreciated.(or is there any other way by which inline editing can achieved in adf)

Upvotes: 0

Views: 971

Answers (1)

Endrik
Endrik

Reputation: 2258

As you've should have noticed , with selection listener the event is triggered only when the selected row changes. So, in case you select the same row, or like in your case, you have just one single row at the moment, it does not get fired. It's how it is meant to work.
My suggestion would be to change the type of event to apply the changes (execute the commit operation). A notable use case is operating with a double-click upon the rows. Check out these samples: Handle double-click in table and Trigger action with double click. It can be easily implemented and keeps the user-interaction simpler (imagine if a user starts playing with the rows and changing them continuously, it would call the backing bean method each time).

Upvotes: 2

Related Questions