Once new row is inserted but not yet saved and if validation rules are defined for the attributes - it may cause problems removing this new row (let's say user changes his mind and decides to remove unwanted row). Of course user can invoke Rollback, but this is not what is always desired. User should be able to remove row with one single click - by pressing Delete button. And this is really easy to achieve in ADF, but not always obvious. You need to set Immediate = true as property for Delete button, it will call then Delete operation ignoring any validations for the current row.
Here you can download working sample application - NewRowRemoveApp.zip.
I will describe first how it works by default. User inserts new record and without providing all required data decides to remove this row by pressing Delete button. Submit happens and ADF brings all failed validation messages - this is not what user expects when simply trying to remove row:
Situation will change with Immediate = true property for Delete button on ADF UI - this allows to skip validation invocation and call Delete operation quietly:
Test again with Immediate = true. Insert new record, try to commit or move to another record to force validation messages:
Press Delete button - problematic record will be removed instantly without reporting validation errors on Delete:
Here you can download working sample application - NewRowRemoveApp.zip.
I will describe first how it works by default. User inserts new record and without providing all required data decides to remove this row by pressing Delete button. Submit happens and ADF brings all failed validation messages - this is not what user expects when simply trying to remove row:
Situation will change with Immediate = true property for Delete button on ADF UI - this allows to skip validation invocation and call Delete operation quietly:
Test again with Immediate = true. Insert new record, try to commit or move to another record to force validation messages:
Press Delete button - problematic record will be removed instantly without reporting validation errors on Delete:
Very Useful Info. Thanks!
ReplyDeletethis is pure JSF :)
ReplyDeleteThis shows that ADF is purely standard framework ;)
ReplyDeleteAndrejus
Hi Andrejus,
ReplyDeleteI've made a delete with an immediate = true. I insert a row in a table (without commiting), then I delete it, then when I insert a new row, the new row has the values of the previous rows displayed (while when I put system.out.println on the getter and setter of the attribures of the EO, the values are null, but the values displayed in my UI are not null).
Can you please enlighten me?
My case is:
ReplyDeleteinstead of table, I use form view.
When I delete new row, I'm expecting the next available row shows up in the form.
But after delete, the form is not populated with existing value. Any solution for this?
thanks
Hi Andrejus,
ReplyDeleteEven I have the same issue as the above anonymous user posted on Sep 4
When I keep immediate = 'false' for delete button I have to manually enter all the values in order to delete row(Since I have required fields). But when I create a new row in table all values are defaulted to null
When I keep immediate='true' for delete button the row is removed with out entering all values. But when I create new row the previously entered values are displayed in newly created row. I want user to be displayed a new row with all null values.
Please help me how to solve this issue. I am using JDev 11.1.1.5
Thanks,
Rajesh.
Ok, I will test it and post update here.
ReplyDeleteAndrejus
This sample is created for JDEV 11g R2 (11.1.2.4.0), I tested your steps - is not reproduced and working fine. I will test the same later in 11.1.1.5
ReplyDeleteAndrejus
Hello Andrejus,
ReplyDeleteI have set immediate = true but it still asking for required values?
Any idea
Does it work in my sample app?
ReplyDeleteAndrejus
I don't have property action delivery on my button..in ADF 11.1.2.4 and even my problem exists..record cannot be deleted..plz help me for solution..
ReplyDeleteIf you see old data, when inserting new row - call ResetUtils.reset method to reset UI state after delete was invoked - http://docs.oracle.com/html/E10684_08/oracle/adf/view/rich/util/ResetUtils.html
ReplyDeleteAndrejus