Instant Row Delete in Oracle APEX - Javainhand Tutorial

Instant Row Delete in Oracle APEX
Instant Row Delete in Oracle APEX

This is Oracle APEX Tutorial which provides you to the simplest way to instant row delete in oracle apex without refresh the whole page using javascript and PL/SQL.

Instant Row Delete in Oracle APEX Using JavaScript and PL/SQL

This Oracle APEX Tutorial helps you to add row delete functionality in a classic report or interactive report. Most of the time, we have to need the same implementation in our oracle apex project. Let's take a simple example that we need to delete an unimportant row from the report. So I will provide the simple and easiest method to achieve it.

Please follow the steps listed below

Step 1:- Create a classic or interactive report with the following SQL query and create also a page item. You can match the following screenshot.

'<a href="#" class="demo" onclick="ok(this)" data-index='||EMPNO||'>
 <button type="button" class="t-Button t-Button--danger t-Button--simple t-Button--stretch">
Delete</button></a>' AS TRASH

As you see in the above code, I am using an anchor tag to create a link in the report and pass the table primary key value in the data-index also I am calling a javascript function on that link, as usual, you can create a report with your database table and pass the table unique value in the data-index. (Note:-Your last column display with full HTML so please go with your column property and off  escape special characters property )

Step 2:- Now I am creating a javascript function that I am calling on the link. Copy the below javascript code and paste it into your page Function and Global Variable Declaration section. You can match the following screen.

function ok(elem){          
    var a=$(elem).data('index');
    apex.item( "P37_EMPNO" ).setValue( a, null, true );//Pass your page item name
(for Ex- EP37_EMPNO)

Step 3:- Now you have to create a click dynamic action to delete a row using PL/SQL and refresh the report. You can match the following screen.

Event:- Click
Selection Type:- Jquery Selector
Jquery Selector:- .demo(Pass class name with a dot)
Event Scope:- Dynamic

True Action:- Execute PL/SQL Code
WHERE EMPNO=:P37_EMPNO(Pass your Page Item);
Items to Submit:- P37_EMPNO(Pass your page item)

Create one more true action Refresh Region.

Selection Type:- Region
Region:- (Pass your Region)

That's all for today I think this Instant Row Delete in Oracle APEX post will helpful for you. If you like this post then share your view in the comment box. Also, Share this post with your friends and also share in the oracle apex related group.

Post a Comment