Sonntag, 9. April 2017

How to edit a report without any page submit and display of a custom Dialog message "Success / Error"

We will work on  a use Case of how to edit a report without loading the page.

Let's start

1- Add a dynamic action as PL / SQL code to edit the report. For example in my case the code below.

DECLARE BEGIN IF length( : P6_HAUSNUMMER ) < 6
THEN UPDATE
        sa_registrieren
    SET
        SAREG_HAUSNUMMER = : P6_HAUSNUMMER
        ,SAREG_USERNAME = : P6_PRICE
        ,SAREG_NACHNAME = : P6_NACHNAME
        ,SAREG_VORNAME = : P6_VORNAME
        ,SAREG_TELEFON = : P6_TELEFON
        ,SAREG_EMAIL = : P6_EMAIL
    WHERE
        SAREG_ID_MELDEN = : P6_ID
; : P6_TESt : = 1
;
ELSE : P6_TESt : = 0
;
END IF
; EXCEPTION WHEN others
THEN : P6_TESt : = 0
;
END
;

The code first checks whether the Item P6_HAUSNUMMER is greater than six. If so, he can save the Records and set
 :P6_TESt:=1 is the Test is Successfully else   :P6_TESt:=0;

2- Add a dynamic action as a javascript code to display the error / success message
if ($v("P6_TEST") == 1) {

    swal("Good job!", "Your product has been successfully modified!", "success")
} else {
    swal({
        title: "Your product has been not successfully modified!",
        text: "Please correct your errors",
        type: "warning",
        showCancelButton: false,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "OK",
        closeOnConfirm: false
    });
}


3- Refresh your Report
$('#IDP').trigger('apexrefresh');

IDP is the Static ID for the Report


4-  Add #APP_IMAGES#sweetalert.min.js in the Javascript Files Url of your page.
Note that you must dowload the Javascript-Plugin for the custom Jquery Dialog  here

5-Add Custom Css


.sweet-alert button {
  background-color:rgb(5,106,191) !important;
  color:rgb(255,255,255);
  border:none;
  box-shadow:none;
  font-size:17px;
  font-weight:500;
  -webkit-border-radius:4px;
  border-radius:5px;
  padding:10px 32px;
  margin:26px 5px 0 5px;
  cursor:pointer;
}

.u-Processing { display:none !important; }


5-Demo


Keine Kommentare:

Kommentar veröffentlichen