我需要在 ojTable 中显示内部 pojo 字段的值。
这是 bakcend 代码:
public class Profile implements Serializable {
private String descr;
private Location location; // I need to show on table -> ojtable
}
public class Location implements Serializable {
private Long id;
private String locationName;
}
和html代码:
<table id="table" summary="Subscriber List"
data-bind="ojComponent: {component: 'ojTable',
emptyText: 'No Data',
data: dataSource,
selectionMode: {row: 'single'},
columnsDefault: {sortable: 'enabled'},
dnd: {reorder: {columns: 'enabled'}},
columns:
[{headerText: 'Description',
field: 'description'},
{ headerText: 'Location Name',
field: 'location.locationName'} ----->>>>>> This one is not working
],
rootAttributes: {'style':'width: 100%; height:100%;'}}">
</table>
在这种情况下,我有 Profile 对象,需要在 html 端到达内部 Location 对象的 locationName 字段。我尝试了 dot notaion -> location.locationName 但它不起作用。
我还尝试了自定义渲染器/敲除模板,但它们都需要一个新的 js 函数用于我需要显示的每个字段,我认为这不是通用的。
请帮助我实现这一目标。
提前致谢。