Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
要预先从外部来源填充单个表单选择列表,请选择所选字段,然后单击“编辑”。
在“选择选项绑定器”菜单下,点击选项绑定器选择栏中的“BeanShell表单绑定器”
在“配置Bean Shell表单绑定器”下,输入您的BeanShell脚本来填充选择字段。对于添加到FormRowSet的每一行,请务必在FormRow中放置“FormUtil.PROPERTY_VALUE”和“FormUtil.PROPERTY_LABEL”字段,并将其添加到FormRowSet中。
To pre-populate a single form select list from an external source, choose the select field and click on 'Edit'.
Under the 'Choose Options Binder' menu, click on 'Bean Shell Form Binder' in the Options Binder select field.
Under 'Configure Bean Shell Form Binder', enter your Bean shell script to populate the select fields. For each row that you add to the FormRowSet, be sure to put the 'FormUtil.PROPERTY_VALUE' and 'FormUtil.PROPERTY_LABEL' fields in the FormRow that will be added to the FormRowSet.
Code Block |
---|
import org.joget.apps.form.model.*;
import org.joget.apps.form.service.*;
public FormRowSet test() {
FormRowSet f = new FormRowSet();
f.setMultiRow(true);
FormRow r1 = new FormRow();
r1.put(FormUtil.PROPERTY_VALUE, "test1");
r1.put(FormUtil.PROPERTY_LABEL, "tester1");
f.add(r1);
FormRow r2 = new FormRow();
r2.put(FormUtil.PROPERTY_VALUE, "test2");
r2.put(FormUtil.PROPERTY_LABEL, "tester2");
f.add(r2);
return f;
}
return test();
|
Of course, you would want to populate the values for PROPERTY_LABEL and PROPERTY_VALUE from your external datasource. For more information on how to connect to a database source, see the example code within 当然,你会想要从你的外部数据源填充PROPERTY_LABEL和PROPERTY_VALUE的值。获取更多关于数据源连接信息的相关操作, 参见示例代码文章: 'Pre-populate Form Fields with Data from External Source' or 或 this example on the Joget Blog.