1. forms标签
1.1 可包含子标签
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
2. form标签
2.1 可包含子标签
form标签可以包含的子标签按顺序排序有:
actions , row-actions , alt-row-style , alt-target , auto-fields-service ,
auto-fields-entity , field , on-event-update-area , sort-order
2.2 form标签常用属性
name
name属性是必须定义的,只有定义了name,才能方便在Screens.xml页面引用表单。
type
type取值主要有三种类型:single,list,multi
single类型:主要用于显示填报数据表单。如何添加或修改实体时使用。
<form name="AddInternalOrg" type="single" target="createInternalOrg" default-map-name="tempObj"
header-row-style="header-row" default-table-style="basic-table">
list类型:主要用于显示列表数据。显示查询结果。
<form name="ListFindTeacher" list-name="listIt" title="" type="list" paginate-target="FindTeacher"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
multi类型:主要用于显示列表数据,标签可以批量操作数据。比如批量删除操作。还可以直接在表格中修改数据。
target
paginate-target
3. actions标签
4. row-actions标签
该标签一般用于list表单。查询结果为list时,对每行记录都执行row-actions标签里的动作。
例子1(applications\accounting\widget\AgreementForms.xml):
<row-actions>
<script location="component://accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy"/>
</row-actions>
例子2(applications\accounting\widget\ap\forms\InvoiceForms.xml):
<form name="ListReports" type="list" separate-columns="true" title="${uiLabelMap.AccountingInvoice} ${uiLabelMap.CommonList}" list-name="invoices" target=""
odd-row-style="alternate-row" default-table-style="basic-table hover-bar" paginate-target="main">
<row-actions>
<service service-name="getPartyNameForDate" result-map="partyNameResultFrom">
<field-map field-name="partyId" from-field="partyIdFrom"/>
<field-map field-name="compareDate" from-field="invoiceDate"/>
<field-map field-name="lastNameFirst" value="Y"/>
</service>
<service service-name="getPartyNameForDate" result-map="partyNameResultTo">
<field-map field-name="partyId" from-field="partyId"/>
<field-map field-name="compareDate" from-field="invoiceDate"/>
<field-map field-name="lastNameFirst" value="Y"/>
</service>
<set field="amountToApply" value="${groovy:
import java.text.NumberFormat;
return(NumberFormat.getNumberInstance(context.get("locale")).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
<set field="total" value="${groovy:
import java.text.NumberFormat;
return(NumberFormat.getNumberInstance(context.get("locale")).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
</row-actions>
5. alt-row-style标签
顾名思义,该标签是修改行样式,比如显示一个列表时希望凸显符合指定条件的行,则可以使用该标签实现。
例子(specialpurpose\example\widget\example\ExampleForms.xml):
<alt-row-style use-when="'EXST_APPROVED'.equals(statusId)" style="Validate"/>
<alt-row-style use-when="'EXST_CANCELLED'.equals(statusId)" style="Warn"/>
6. auto-fields-service标签
该标签是自动填充表单,如果定义了该标签,会自动根据服务返回结果生成对应表单。
例子1(applications\accounting\widget\AgreementForms.xml):
<auto-fields-service service-name="updateAgreementTerm"/>
例子2:
<auto-fields-service service-name="updateContentPurposeOperation" default-field-type="display"/>
例子3(applications\content\widget\website\WebSiteForms.xml):
<auto-fields-service service-name="updateWebSiteRole" map-name="webSiteRole" />
7.auto-fields-entity标签
8.field标签
8.1 可包含子标签
8.2 常用属性
name
map-name
<form name="EditAcctgTrans" type="single" target="updateAcctgTrans" default-map-name="acctgTrans"
header-row-style="header-row" default-table-style="basic-table">
<auto-fields-service service-name="updateAcctgTrans"/>
<field name="acctgTransId"><display/></field>
<field name="organizationPartyId" map-name="parameter"><hidden/></field>
entry-name
<field name="glAccountId" position="2" entry-name="resetFieldValue">
<drop-down allow-empty="true">
<entity-options entity-name="GlAccountOrganizationAndClass" key-field-name="glAccountId" description="${accountCode} - ${accountName} [${glAccountId}]">
<entity-constraint name="organizationPartyId" operator="equals" env-name="parameters.organizationPartyId"/>
<entity-order-by field-name="accountCode"/>
</entity-options>
</drop-down>
</field>
entry-name默认值是name;用于指定映射中包含要填充的值的项的名称。
tooltip
<field use-when="teacher!=null" name="tchId" title="${uiLabelMap.BookingTeacherTchId}" tooltip="${uiLabelMap.BookingNotModification}." ><display/></field>
提示用户该字段不能编辑修改。如下图中t003后面显示 “不能修改”.
required-field
use-when
title
9.on-event-update-area
当对应表单事件发生时,指定局域会自动刷新。
9.1可包含的子标签
9.2包含的属性
10.sort-order
这个不常用。