Freitag, 25. November 2011

Establish the multi row delete button...

Unfortunatly there is no delete button on page 3. I could create one myself, but I prefer to copy the delete button and its behaviour from page 4 and modify it.
I copy the button region PLSQL Profiler Runs.

I run page 3, click on my button and nothing happens (That's ok, because I have only copied the button yet).
So I activate firebug (F12 in the most cases) and find the message "htmldb_delete_message is not defined" on the konsole.



I copy the javascript definition from page 4

var htmldb_delete_message='"DELETE_CONFIRM_MSG"';

and give it another try. I confirm the delete message, and nothing happens. No message can be found in firebug this time, so I have a look on the definition of the button.
First I remove the condition pointing on P4_RUNID. A simple condition will not help in our case.
Then I take a look at the "URL Target".

javascript:apex.confirm(htmldb_delete_message,'DELETE');

Ok, looks like if I confirm the htmldb_delete_message there will be a DELETE request submitted.

On page 4 the process Process Row of PLSQL_PROFILER_RUNS is handling this request, but this process is of type "Automatic Row Processing (DML)" and does not handle multiple rows.
So I will have to create a new one.
I create a new "Page processing" process with the name Process Row of PLSQL_PROFILER_RUNS on page 3. The condition has to be set to "Request = Expression 1" and Expression 1 of course to "DELETE".

This will be the source (for now)

BEGIN
  FORALL i IN apex_application.g_f01.FIRST .. apex_application.g_f01.LAST
    DELETE FROM plsql_profiler_runs
    WHERE       runid = apex_application.g_f01(i);

  apex_application.g_print_success_message := SQL%ROWCOUNT || ' row(s) deleted';
END;

Our checkboxes have the name f01 (see the last post) and all checked runid's will end up in the apex_application.g_f01 collection.

Everything could be fine, but when select at least on record and press the button ORA-02292 is shown. I'm trapped by referential integrity.

The same message is shown when I try to delete a single record on page 4.

To be continued...

Keine Kommentare:

Kommentar veröffentlichen