Almost two years ago, I wrote a little blog on how to trigger a Dynamic Action from a report. You can find that blog right here.
Things have changed with APEX5 (which is currently still in "early adopter 2") which allow you to do this in a more clean way (or at least I think so). No need to create a "fake link" so the user know that the icon is clickable. No need to upload your own images, use the already shipped Font Awesome library.
Based on that old blogpost I reused the same table structure and the same PL/SQL procedure. The only change I made was to the query on which the report is based:
select id tsk_id ,case ind_complete when 'Y' then 'up' when 'N' then 'down' end ind_complete ,what ,complete_before from tasksInstead of "ok" and "nok" for the "IND_COMPLETE" column, I am using "up" and "down". These names will be used to get the correct Font Awesome icon. If you want to use different icons, check the Font Awesome Cheatsheet, version 4.0.3 (the version currently used by the early adopter.
Instead of having to create a Link Column, linking to a dummy page like Page 0, the IND_COMPLETE column can stay a "Plain Text" column.
Adjust the HTML expression for that column to:
<span class="t-Icon fa-thumbs-o-#IND_COMPLETE# setComplete" id="#TSK_ID#" style="cursor: pointer;" ></span>The class added to the IND_COMPLETE column will contain the reference to the Font Awesome icons you want to show. The class "setComplete" is there to have the Dynamic Action fire when the column is clicked. The id reference is there, so the Dynamic Action will know which ID to update in the table. Finally styling the cursor so the user will know that the icon is clickable.
Next the Dynamic Action. The Dynamic Action is basically the same as in the original version:
- Set the value of the clicked element in a hidden item
- Execute the stored Procedure
- Refresh the report
And just for fun, add some CSS styling at page level:
.fa-thumbs-o-up{ color: #2580D4; } .fa-thumbs-o-down { color:red; font-size: 20px; }That will really make the Font Awesome icons stand out :)
No comments:
Post a Comment