Some times we edit a table in form and Save(Commit & Execute) or Cancel(Rollback & Execute) and table refreshed to its first record means focus is now on first row of table.
And we need the same row again, then we search it and perform another operation, this is really disgusting behavior of table for Developer.
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.
And we need the same row again, then we search it and perform another operation, this is really disgusting behavior of table for Developer.
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"); ob.execute(); OperationBinding ob1= bindings.getOperationBinding("Execute"); ob1.execute(); //Set again row key as current row parentIter.setCurrentRowWithKey(parentKey.toStringFormat(true));
Nice Info Ashish
ReplyDeletethank you Abhijit.,.,!!!
DeleteHello Ashish:
ReplyDeleteCan you please detail the code with the import statements as well? I am using 11.1.2
I could not get the code working.
Thanks
Krishna
Use these import statement-
Deleteimport oracle.adf.model.binding.DCIteratorBinding;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
import oracle.jbo.Key;
I think it should work fine now
Thank you for the reply and also to the blog post.
DeleteI am using ADF form to display data. I get null pointer exception for getCurrentRow(). Should I be using table control?
Are you using only form? or both table and form. (Use table and form both)
ReplyDeleteand Ensure that you have written Iterator Name(Table Iterator) same as in binding of page is given.
hello Ashish;
DeleteIam 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.
soodesh
Nice Post.Thanx.
ReplyDeleteHi Ashish,
ReplyDeleteI 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,
Murat
I just realized the row doesn't disappear.
Deleteits 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
It is not a problem , after commit due to order by row will appear as per the clause
DeleteBut in this way, user will need to order by row manually at all time, right?
DeleteUser has already changed row values and committed data then why he/she need to navigate to that row again ?
DeleteStill you can try Jump to specific row in ADF Table
Ashish
We have interesting customers :D
DeleteAnyway many thanks Ashish.
You rock as always
where should i put this code
ReplyDeleteYou can use this code in managed bean where you need to set current row after execute of table or viewObject
DeleteAwesome post. Was able to fix the issue with ease
ReplyDelete