434 total views, 7 views today

ADF delete row programmatically

In this section, I have explained deleting a record from an ADF table programmatically. I have used the Country table in HR schema for this example. 

 

ADF delete row programmatically – Started

 

In my ADF model project, I have created EO and VO of the country table. The following methods in the AppModuleimpl java class will delete the selected row and first record

 

removeCurrentRow() => removes the record the user is viewing at the time .

removeFirstRow() => Removes first record in the table

 

050516_0345_Deleterecor1 ADF delete row programmatically

 

Expose this method

We need to expose this method to make it available for UI. The below step is doing the same.

 

Double click on the AppModule.xml file >> Click Java >> Click the pencil icon >> Drag that method to the selected column as shown below & click Ok

 

050516_0345_Deleterecor2 ADF delete row programmatically

 

Test removeCurrentRow

1. Right click the APpModule.xml and click Run

 

2. An appmodule wizard appears on the screen. Double click on the CountryEOView1 object. You will get the Argentina as the record loaded on the screen similar to below

 

050516_0345_Deleterecor3 ADF delete row programmatically

 

3. Double click on the AppModule >> Select removeCurrentRow() >> click execute . The Argentina is the current record you are viewing got deleted.

 

050516_0345_Deleterecor4 ADF delete row programmatically

 

4. To check this, double click the CounryEOView1 again, you will see Australia is loaded and no more Argentina

 

050516_0345_Deleterecor5 ADF delete row programmatically

 

Test removeFirstRow

Double click on the AppModule >> Select method removeFirstRow >> Click Execute. You will get the below error pop up saying about the foreign key violation because the record has been used by some other table.

 

050516_0345_Deleterecor6 ADF delete row programmatically

govindan ADF delete row programmatically
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply šŸ™‚
govindan ADF delete row programmatically
Connect me
Like us on Facebook.
Connect!