Template Components are a relatively new feature of Oracle APEX. I won't go into details about what they are or how to create your own components. There are plenty of examples out there already, like this one.
Following these tutorials, I created my agenda Template Component based on this example I found on internet (see the agenda report on the right).
The data for this report comes from a simple TC_AGENDA table and this query:
select id
, rownum row_num
, icon_class
, time
, primary
, short
, description
from tc_agenda
With some tweaking for APEX (like using Font Apex icons), I ended up with:
One thing that I missed in Template Components is the ability to easily add input items. I wanted to explore the options using this example and change the fixed description into a text area where you can change the description.
The end result looks like:
So, how can you do that?
Of course, you start with the original Partial template, that looks like:
It is easy enough to change the DESCRIPTION HTML paragraph to an INPUT or, in this case, TEXTAREA component. However, that does nothing with the user input when you submit the page.
To actually be able to capture and save the description entered by the user, you have to fall back on the APEX_ITEM API and how APEX handles this data.
Note: the APEX team considers APEX_ITEM "Legacy" and may remove the API in a future release. However, as long are there is no alternative, this API will still work.
APEX_ITEM generates items with a name attribute f01, f02, etc. When APEX sees these items after a page submit, it puts the values in the APEX_APPLICATION.G_Fnn arrays.
Knowing this, you can use the name attribute without actually using APEX_ITEM.
The DESCRIPTION paragraph can now be changed to:
The first, hidden, item, with the name "f01" holds the Primary Key value of the row (here #ID#).
The second item, with name "f02", is the text area that holds the description (#DESCRIPTION#).
You can now create a submit Process to update the description in the agenda table (TC_AGENDA):