Forum Stats

  • 3,751,644 Users
  • 2,250,380 Discussions
  • 7,867,491 Comments

Discussions

Alert for Deleting Rows

Prakya Sundar
Prakya Sundar Member Posts: 34
edited Apr 15, 2016 4:18AM in APEX Discussions

I have Created an Classic Report Region with 6 Columns and the first column is the Select Box Column And also a Delete Attachment button in that Region. If iam not selecting a row and Clicking on that delete attachment button there is no alert as"Select one Row" and also if there is no row and if am clicking on delete attachment button ,in here too i didnt received the alert as " There is no Attachment". How to Fix this.

Tagged:
ReemaPuriPrakya SundarMahmoud_Rabie

Best Answer

  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect, Member Posts: 3,216 Bronze Crown
    edited Apr 11, 2016 6:26PM Accepted Answer

    Hi Prakya

    I have created a solution for you. It is based on creating the checkbox in the classic report then getting number of checked rows. Please check your demo

    https://apex.oracle.com/pls/apex/f?p=11724:6

    Steps:

    1) Add STDID as PK column of your table STUDENT

    2) Write the SQL of the Standard Report

    select apex_item.checkbox(1,STDID,'UNCHECKED' ) as "CHECK",
           NAME,
           AGE
      from STUDENT
    
    
    
    
    

    3) Create a hidden item to hold the checked rows count P6_CHECKEDCOUNT

    4) Using Component View, update the type of the column CHECK to be Standard Report Column

    5) Create a dynamic action on change of the jQuery selector td[headers="CHECK"] input

    - Execute JavaScript

    var checkedrowscount = $('td[headers="CHECK"] input:checked').length;
    $s("P6_CHECKEDCOUNT",checkedrowscount);
    
    
    
    
    

    6) Update the Delete Button to be Defined by Dynamic Action

    - Execute JavaScript

    var checkedcount = $v('P6_CHECKEDCOUNT');
    alert(checkedcount + ' row(s) checked');
    
    var checkedrowsarray =$('td[headers="CHECK"] input:checked');
    
    $.each(checkedrowsarray , function(index, val) {
        alert(val.value);
    });
    
    
    
    
    

    7) DELETE the checked rows

    You could achieve this final step by updating the above JS code to call PL/SQL of DELETE checked rows.

    Here is a useful link

    Grassroots Oracle: Calling PL/SQL from JavaScript in APEX

    Regards

    Mahmoud

«1

Answers

This discussion has been closed.