Stay on Current row after Rollback Execute or page refresh

Sharing is Caring

Sometimes we edit a table in form and Save(Commit & Execute) or Cancel(Rollback & Execute)  and table refreshed to its first record, means the focus is now on the first row of the table. Now if we need the same (previous) row again, then we have to search it and perform another operation, this is the really disgusting behaviour of the table for the developer. So here development requirement is to stay on current row of af:able after execute operation.

To set on previously selected row after execute we can use this code,
In this scenario, we have to get current row key from its IteratorBinding and after Execute we can set it again to show that row as selected.

     * Generic Method to call operation binding
     public BindingContainer getBindings() {
      return BindingContext.getCurrent().getCurrentBindingsEntry();
	 BindingContainer bindings = getBindings();
     //Get Iterator of table
     DCIteratorBinding parentIter = (DCIteratorBinding)bindings.get("IteratorName");
     //Get current row key
    Key parentKey = parentIter.getCurrentRow().getKey();

     //You can add your operation code here, I have used simple Cancel operation with Rollback and Execute
	OperationBinding ob= bindings.getOperationBinding("Rollback");
    OperationBinding ob1= bindings.getOperationBinding("Execute");

    //Set again row key as current row



Related Posts

0 thoughts on “Stay on Current row after Rollback Execute or page refresh”

  1. Use these import statement-

    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    import oracle.jbo.Key;

    I think it should work fine now

  2. Thank you for the reply and also to the blog post.
    I am using ADF form to display data. I get null pointer exception for getCurrentRow(). Should I be using table control?

  3. hello Ashish;
    Iam using database view as adf table it will work.Can you tell where to place this code.It is a java code i am new to adf.

  4. Hi Ashish,

    I have a read-only view object and has a primary key on it.

    I have a table and formlayout on my page.

    I can set selected row key to parent key after commit and execute and i can see details of this row on my form layout.

    But in my table, this row disappears.

    Is there a way to avoid it?

    Thanks in advance!

    Best Regards,

  5. I just realized the row doesn't disappear.

    its row number is changed to 26.

    Even the iterator has sor order by primary key, it doesnt sort rows accordingly sort criteria.

    My edited row goes to 26. row in my table.

    Is there a way to see the row where it was before commit and execute?

    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *