0

I have created a grid view of Leavemaster table and leaveApplication table. There is field LeaveId in LeaveMaster and foreign key in LeaveApplication table.

I want to, when I select leaveId in LeaveAppliation table, automatically have related fields like LeaveName be filled according to LeaveId.

4

2 回答 2

0

如果您只想显示leaveName使用上定义的显示方法LeaveApplicationTable

display EmplName leaveName()
{
    return LeaveMasterTable::find(this.LeaveId).Name;
}
于 2010-04-14T11:50:07.877 回答
0

如果您要显示更多字段,请考虑使用outer-join. 在LeaveApplicationTable表单中添加LeaveMasterTable作为辅助数据源并outer-join用作joinModeAllow-Edit:false)。

向数据源上的字段添加modified方法:LeaveIdLeaveApplicationTable

public void modified()
{
    super();
    leaveMasterTable.data(LeaveMasterTable::find(leaveApplicationTable.LeaveId));
    leaveMasterTable_ds.refresh()
}

还要更改数据源的validateWritewrite方法LeaveMasterTable以不更改任何数据:

public boolean validateWrite()
{
     return true;
}

public void write()
{
     //super();
}
于 2010-04-14T12:14:09.780 回答