Today there was a need of using simple, dictionary SQL query result as an array in JavaScript. Solution is quite simple - region with PL/SQL Dynamic Content.
Here you have a short video with example. Changing Select List causes showing Checkboxes in rows, on which specific action can be processed.
Code of PL/SQL region, which creates array:
JavaScript code for Dynamic Action, which uses the array:
Here you have a short video with example. Changing Select List causes showing Checkboxes in rows, on which specific action can be processed.
Code of PL/SQL region, which creates array:
htp.p('<script>');
htp.p('var actions = [];');
for x in
(select ID, STATUS_FROM
from ACTIONS
)
loop
htp.p('actions[' || x.id || '] = "' || x.status_from || '";');
end loop;
htp.p('</script>');
JavaScript code for Dynamic Action, which uses the array:
$("input[name='f02']").each(function(){
if (this.getAttribute("status") == actions[$v("P18_ACTION")]) {
this.style.display = "block";
} else {
this.style.display = "none";
}
});
Comments
Post a Comment