jeudi 13 août 2020

Interactive report check all values for department

Using the query below as an example. I want a checkbox which checks all employees in a department, and leave unchecked if employee is in another deparment.

SELECT ID,
       DEPT_ID,  
       APEX_ITEM.CHECKBOX(
       p_idx                       => 1,    
       p_checked_values_delimitor  =>':',
       p_item_id                   => 'f01_'||id) AS CB    
 FROM DEPT
ORDER BY DEPT_ID;

In the heading of the column 'CB' I am using '<input type="checkbox" id="selectAll">' to create a check all field and using

'if ($('#myReport #selectAll' ).is(':checked') ) {
  $('#myReport input[type=checkbox][name=f01]').prop('checked',true);
} else {
  $('#myReport input[type=checkbox][name=f01]').prop('checked',false);
}'

as javascript to check all boxes.

As an example of what i'd like to achieve is:

emp_id, dept_id, checked
-----------------
1, 1, checked
2, 1, checked
3, 1, checked
4, 1, checked
5, 2, unchecked
6, 3 unchecked

However what I am getting now is

emp_id, dept_id, checked
-----------------
1, 1, checked
2, 1, checked
3, 1, checked
4, 1, checked
5, 2, checked
6, 3, checked



Aucun commentaire:

Enregistrer un commentaire