I've written collapsible list in PL/SQL dynamic content using HTML and JavaScript.
Is there any way to insert ID of clicked item into table? Clickable fields are buttons.
Thanks
edit
for i in c loop
HTP.P('<button type="button" class="collapsible">
'i.Header of list'
('</button><div class="content"><p>'i.content of list'</p></div>'));
end loop;
Here is an example based on the EMP/DEPT sample dataset.
Step 1: Create pl/sql dynamic content region. Make sure the button has a (1) a custom class to capture the click event and (2) a data attribute to uniquely define the row.
for i in (SELECT * FROM emp) loop
htp.p(apex_string.format('</button><div class="my-button-js content" data-empno="%0"><p>%1</p></div>',i.empno,i.ename));
end loop;
Step 2: create a (hidden) page item to hold the identifier of the row you clicked, in my case P104_EMPNO.
Step 3: Create a dynamic action to set the value to P104_EMPNO to the value empno of the row button you clicked in the report.
True Action 1:
this.triggeringElement.dataset['empno']
True Action 2:
$.event.trigger("mybuttonclicked");
Step 4: Create a dynamic action to fire on the custom event you fired in True Action 2 of Step 3.
document
True Action 1:
UPDATE EMP SET sal = sal * 1.1 WHERE empno = :P104_EMPNO;