问题
I have following instructions on this post https://apextips.blogspot.com/2015/05/building-dynamic-forms.html on how to create dynamic items in APEX. The documentation https://docs.oracle.com/cd/E59726_01/doc.50/e39149/apex_item.htm#AEAPI192 is clear on how to create the item but I cannot figure out how to make the item look like native APEX items.
I have attempted copying different CSS classes I can see attached to the native items but for the life of me, I cannot get my dynamically created form elements to look and act the same.
Any help would be greatly appreciated.
回答1:
If you are using Chrome Browser, then the easiest way to get all the styles is to use the browser Copy styles.
Right click on an item created natively and select Inspect. Right click on the selected HTML element under Elements tab and go to Copy => Copy styles
This will get you the styles associated with the native item. Now assign those styles to your dynamically generated item.
You need to do this for every item type.
Best Regards, Salim
回答2:
Hi – just to add to Dan’s and Salim’s comments and recommendations. I agree that for this particular use case, APEX_ITEM work well. However, as Dan pointed out, the APEX_ITEM API is considered legacy code. While we may never actually remove this API from APEX, as this would break too many apps, we do not plan on developing this API further. There are many reasons, but really comes down to the APEX_ITEM API using its own code to render page items, and all new components, including standard form items and Interactive Grid form items, share the same, more modern implementation, which is fully integrated with the Universal Theme and accessible. There are also significant differences in the way form items are submitted to the server and the way this data is processed. We’re working towards providing better alternatives to the APEX_ITEM in the future. - Marc
回答3:
This should help:
with
TP_ORDEM_SERV_REC as (
select C.ID_FUNCAO,
C.QT_EXEC
from TB_ORDEM_SERV_REC C
where C.ID_ORDEM_SERV = :P922_ID_ORDEM_SERV
and C.NUM_TAR = :P922_NUM_TAR)
select A.DESC_SUPLEMENT FUNCAO,
'<div class="t-Form-fieldContainer t-Form-fieldContainer--floatingLabel lto'||A.ID_SUPLEMENT||' apex-item-wrapper apex-item-wrapper--text-field" id="it_'||A.ID_SUPLEMENT||'_CONTAINER">'||
'<div class="t-Form-labelContainer">'||
'<label for="it_'||A.ID_SUPLEMENT||'" id="it_'||A.ID_SUPLEMENT||'_LABEL" class="t-Form-label">Quant. Exec.</label>'||
'</div>'||
'<div class="t-Form-inputContainer">'||
'<div class="t-Form-itemWrapper">'||
'<input type="hidden" name="f01" value="'||A.ID_SUPLEMENT||'" />'||
'<input type="text" name="f02" id="it_'||A.ID_SUPLEMENT||'" name="it_'||A.ID_SUPLEMENT||'" class="text_field apex-item-text" value="'||A.QT_EXEC||'" size="1" maxlength="2">'||
'</div>'||
'<span id="it_'||A.ID_SUPLEMENT||'_error_placeholder" class="a-Form-error" data-template-id="'||A.ID_SUPLEMENT||'_ET"></span>'||
'</div>'||
'</div>' QT_EXEC
from TB_SUPLEMENT A,
TB_USUARIO B,
TP_ORDEM_SERV_REC C
where A.FLAG_CTRL = 15
and B.ID_OFICINA = :P922_ID_OFICINA
and A.ID_SUPLEMENT = B.ID_FUNCAO
and B.ID_FUNCAO = C.ID_FUNCAO (+)
group by A.DESC_SUPLEMENT,A.ID_SUPLEMENT,C.QT_EXEC
Then, just use apex_application.g_f
to manipulate the result in the process as normal.
来源:https://stackoverflow.com/questions/61421040/oracle-apex-style-apex-item-dynamic-form-elements