Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

ชื่อคำอธบาย
Script

สคริปต์ในภาษาจาวา

สคริปต์ทั้งหมดเป็นค่าเริ่มต้นที่จะนำไปใช้กับทุกแถวในคอลัมน์ดังกล่าวดังนั้นผู้ใช้จึงไม่จำเป็นต้องดำเนินการวนรอบเพื่อใช้การเปลี่ยนแปลงกับทุกแถว

  • datalist - org.joget.apps.datalist.model.DataList
  • column - org.joget.apps.datalist.model.DataListColumn
  • row - Object in DataListCollection (org.joget.apps.datalist.model.DataListCollection) returned by DataListBinder (org.joget.apps.datalist.model.DataListBinder).
    ในการดึงค่าคุณสมบัติจากแถว Object  ให้ใช้บริการเมธอดนี้: DataListService.evaluateColumnValueFromRow(Object row, String propertyName)
  • value - String
ส่งคืนสตริง
Code Block
titleSample Code
linenumberstrue
return value + "append this text to every column value";


It is also possible to inject hash variables into the values.นอกจากนี้ยังเป็นไปได้ที่จะใส่ตัวแปรแฮชเข้าไปในค่า

Code Block
titleSample Code
linenumberstrue
return value + " #currentUser.firstName#";


Example code using ตัวอย่างโค้ดโดยใช้บริการเมธอด DataListService service method:

Code Block
titleSample Code
linenumberstrue
//import the necessary classes
import org.joget.apps.datalist.service.DataListService;
import org.joget.apps.app.service.AppUtil;

DataListService dataListService = (DataListService) AppUtil.getApplicationContext().getBean("dataListService");
 
//since this entire bean shell applies to every row, "row" is automatically iterated here.
//"name" is the column id
return dataListService.evaluateColumnValueFromRow(row, "name");

...