To call a function/method, just append "#" plus the function/method name
to the script location.
-Adrian
On 3/10/2012 8:35 AM, Jacopo Cappellato wrote:
Hi all,
from the widgets (screens, forms...) we can call a script using the following
syntax:
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy"/>
What about adding an optional "invoke" attribute to it, to specify a method in
the script?
For example:
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy"
invoke="someMethod"/>
In this way we would enable components to reorganize their scripts into less
source files; for example, instead of having:
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy"/>
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategoryContentContent.groovy"/>
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy"/>
we could group the three files into one with three methods:
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryScripts.groovy"
invoke="editCategory"/>
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryScripts.groovy"
invoke="editCategoryContentContent"/>
<script
location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryScripts.groovy"
invoke="editCategorySeo"/>
Jacopo