You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Nicolas Malin (Jira)" <ji...@apache.org> on 2021/08/31 16:33:00 UTC
[jira] [Created] (OFBIZ-12310) Rendering widget screen from ftl
with the current context
Nicolas Malin created OFBIZ-12310:
-------------------------------------
Summary: Rendering widget screen from ftl with the current context
Key: OFBIZ-12310
URL: https://issues.apache.org/jira/browse/OFBIZ-12310
Project: OFBiz
Issue Type: Improvement
Components: framework/widget
Affects Versions: Trunk
Reporter: Nicolas Malin
Currently when you would be rendering a widget screen from a ftl template, you can use a element screen present on context to call the renderer :
{code:java}
${screens.render("component://common/widget/CommonScreens.xml#countries")}
{code}
This rendering is realized with the context present when the object screen has been initialized.
To simplify the screen call from freemarker template, I implemented a new macro *ofbizScreen*
You can call a Ofbiz screen with the ftl context with simple macro
{code:java}
<@o...@ofbizScreen>{code}
You can also write
{code:java}
<@ofbizScreen location="component://mycomponent/widget/MyComponentScreens.xml" name="MyScreen"/>{code}
Or set a default location on your context
action :
{code:java}
context.defaultTemplateLocation = "component://mycomponent/widget/MyComponentScreens.xml"{code}
widget :
{code:java}
<@o...@ofbizScreen>{code}
When the screen would be call, the context to rendering the screen would be use the current context:
{code:java}
<#list contactMechs as contactMech>
<#assign contactMechId = contactMech.contachMechId/>
<@o...@ofbizScreen>
</#list>
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)