1. เพิ่มโค้ดลงใน screen ดังนี้
<container style="screenlet-title-bar">
<container style="h3">
<section>
<condition>
<if-empty field="projectId"/>
</condition>
<widgets>
<label style="h3" text="${uiLabelMap.PageTitleEditProject}"/>
</widgets>
<fail-widgets>
<label style="h3" text="${uiLabelMap.iMAS_ProjectMgrEditProject}"/>
</fail-widgets>
</section>
</container>
</container>
อธิบายโค้ด
ในส่วน section ของ titlebar ให้กำหนดเงื่อนไขว่า เมื่อไม่มีค่า projectId ส่งมา ให้เรียกใช้ widget ที่มี label ที่เรียกใช้ uiLabelMap ชื่อ PageTitleEditProject
แต่เมื่อมีค่า projectId ส่งมาด้วย ให้เรียกใช้ widget ที่มี label ที่เรียกใช้ uiLabelMap ชื่อ iMAS_ProjectMgrEditProject
2. ในส่วน screen ที่มีการเรียกใช้ form ให้เพิ่มโค้ดดังนี้
<container style="screenlet-body">
<section>
<widgets>
<platform-specific>
<html><html-template location="component://imas-project/webapp/imas-project/page/NewCustomerButton.ftl"/></html>
</platform-specific>
<include-form name="EditProject" location="component://imas-project/widget/forms/ProjectForms.xml"/>
</widgets>
<fail-widgets>
<include-form name="EditProject" location="component://imas-project/widget/forms/ProjectForms.xml"/>
</fail-widgets>
</section>
</container>
อธิบายโค้ด
จากข้อ 1 ในส่วนของ condition ถ้ามีการส่งค่า projectId จะเรียกใช้ widget ที่เรียกไฟล์ NewCustomerButton.ftl มาแสดงผลพร้อมกับ form ชื่อ EditProject
แต่ในทางกลับกัน ถ้าไม่มีการส่งค่า projectId ก็จะเรียก form ชื่อ EditProject มาแสดงผลเพียงอย่างเดียว
ไม่มีความคิดเห็น:
แสดงความคิดเห็น