Column in extended table are not presented in form data on Eclipse Scout

为君一笑 提交于 2019-12-02 09:39:44

Array based TableData:

If you methods like this in the FormData:

LoremTable table = formData.getLoremTable();
int r = table.addRow();
table.setAaaa(r, "Hello world");
table.setBbbb(r, 42);

You are using Array based TableData.


Bean based TableData:

If you methods like this in the FormData:

IpsumTable table = formData.getIpsumTable();
IpsumTableRowData rowData = table.addRow();
rowData.setAaaa("Hello world");
rowData.setBbbb(42);

You are using Bean based TableData.


Your case:

To summarize your case, you have a TableField with a Table having a complex inheritance graph looking like that:

AbstractTable
|   (no columns defined as inner class)
|
\---AbstractTreeTable
    |   (2 columns defined as inner class: ParentKeyColumn and KeyColumn)
    |
    \---MyTableField.Table
            (additional columns defined as inner class)

You will need bean based table data, because with array based table data, the SDK will only consider the columns of MyTableField.Table to generate the formData. With bean based table data you will get all the columns you expect.


A possible way to solve your problem, is to change the generated table data in the formData. This is configured on the table field class in the form.

Check the type hierarchy of your table field class:

AbstractTableField (defined in the scout jar -> you can not modify it)
|   
\---MyTableField

The SDK checks the FormData annotation down the type hierarchy.

With Scout Version smaller than 4.2, AbstractTableField is configured to use array based table data. With version bigger than 4.3 it is configured to use bean based table data.

At each level you can define something else. For example at MyTableField level. You can do something like that:

@FormData(sdkCommand = FormData.SdkCommand.USE, value = AbstractTableFieldBeanData.class, defaultSubtypeSdkCommand = FormData.DefaultSubtypeSdkCommand.CREATE)
public class MyTableField extends AbstractTableField<MyTableField.Table>

This will change the generated code.


On the wiki you can read additional examples. For example is you have something like:

AbstractTableField 
|
\---AbstractMyAppTableField
    |
    \---MyTableField

You can define the table data you want at AbstractMyAppTableField. If all your table field extends AbstractMyAppTableField (which is a recommended practice), with one single config you can change all the table data of your application and you ensure that each developer will use the same pattern.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!