HI ALL,
I want to achieve this functionality. when I click ADD on the item, the item is automatically added to the apex_collection. How to achieve this in oracle apex
I have tried classic report with cards template but got stuck in the middle
I have created the cards. Now want to add data to the apex_collection…. For that I have column links
Target : URL
URL : javascript:$s(‘P8_ACTION’,’#PRODUCT_CODE#’);
Also created the hidden item P8_ACTION and added
dynamic action–> execute server side
Begin IF not apex_collection.collection_exists('MY_COLLECTION') then apex_collection.create_collection('MY_COLLECTION'); end if; apex_collection.add_member( p_collection_name => 'MY_COLLECTION', p_c001 => :P8_ACTION ); END; /
2
Answers
I have created a page with classic report and cards template
And on the column Type : Link
Here is an example on the EMP table. It’s using a javascript custom event which means all javascript nicely grouped in the dynamic action.
Create Cards Report
Generate a cards region through the wizard on the sample data
EMP
table. Just take the defaults. Note that this is NOT a classic report. Is is a region of type "Cards".Add a button to the card: In "Body" section of the card, add HTML Expression with source
Note the
data-id=&EMPNO.
attribute andadd-emp
classButton was build using button builder
Add a page item to the region to store the selected EMPNO (P158_EMPNO)
Dynamic Action
True action 1 (Set value of P158_EMPNO on button click)
P158_EMPNO
True Action 2 (Add row to collection)
P158_EMPNO
Note that this is basic code. It does allow a record to add more than once, I’m not cleaning up the collection etc. But you should get the point.