下面的代码启动一个窗体和子窗体,问题是I获取父窗体的subform实例:
await actions.loginTest();
const form = await actions.priority.formStart(this.formName,
onShowMessgeFunc, onUpdateFieldsFunc);
console.log("form", form);
if(form.subForms["SHIPTO2"]) {
const subForm = await form.startSubForm("SHIPTO2");
console.log("subform", subForm);
subForm.choose("CUSTDES", '').then(options => {
let custOptions = options.SearchLine.map(x => {return
{label:x.retval + " - " + x.string1, value: x.retval }});
this.setState({
customersShippingOptions: custOptions,
})
}).catch((err) => {
console.log("CHOOSE ERROR", err);
})
}输出:
发布于 2018-08-23 15:39:57
为了启动子窗体,父窗体中必须有活动的行,因此该子窗体将为该行启动。
在启动子窗体之前,应该使用getRows()函数来检索行,然后调用setActiveRow(rowIndex)来设置活动行。然后,您可以启动子窗体。
将您的代码修改为:
await actions.loginTest();
const form = await actions.priority.formStart(this.formName,
onShowMessgeFunc, onUpdateFieldsFunc);
console.log("form", form);
const rows = await form.getRows();
await setActiveRow(5);
if(form.subForms["SHIPTO2"]) {
const subForm = await form.startSubForm("SHIPTO2");
console.log("subform", subForm);
...
}顺便说一下:我看到你在使用choose(),这里也需要有一个活动的(子窗体)行,使用getRows()和setActiveRow(),或者在调用choose()之前创建一个newRow()
发布于 2018-08-23 16:10:00
如果您不想仅仅使用函数formStart中的autoRetrieveFirstRows参数,而是希望在屏幕上显示第一行
Link to the function on the Web SDK site
我个人将此值定义为默认值
https://stackoverflow.com/questions/51970526
复制相似问题