CRUDified 对象中的自定义显示
我有一个实体通过 MappedLongForeignKey 引用另一个实体。
我正在使用 CRUDify 特征并遇到问题。
Entity 1:
id
title (String)
validTo (Date)
Entity 2:
id
...
fk_entity_1 (mapped via MappedLongForeignKey)
在 CRUDify 为实体 2 生成的列表中,我想包含一个格式化的列,因为
fk_entity_1.title ( fk_entity_1.validTo )
我尝试创建一个返回此类字符串的函数并将该 fn 添加到 fieldsForDisplay,但 fieldsForDisplay 似乎需要映射字段。
这有可能实现吗?
* 编辑 * 我想要完成的是(使用 CRUDify 的内置功能进行列表)生成列表:
{Entity 2 fields} "Entity 1"
... Title_X (2001-01-01)
... Title_Y (2011-02-02)
如果情况更糟,我可以推出自己的列表,但我真的很喜欢 CRUDify 功能。
I have a an entity referencing another entity by MappedLongForeignKey.
I am using the CRUDify trait and have a problem.
Entity 1:
id
title (String)
validTo (Date)
Entity 2:
id
...
fk_entity_1 (mapped via MappedLongForeignKey)
In the listings generated by CRUDify for entity 2 I would like to include a column formatted as
fk_entity_1.title ( fk_entity_1.validTo )
I tried to create a function returning such a string and adding that fn to fieldsForDisplay, but it seems fieldsForDisplay requires mapped fields.
Is this possible to accomplish?
* Edit *
What I am trying to accomplish is (using the built in functionality of CRUDify for listings) produce listings as:
{Entity 2 fields} "Entity 1"
... Title_X (2001-01-01)
... Title_Y (2011-02-02)
If worse comes to worst, I can roll my own listings, but I really like the CRUDify functionality.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太确定你想要完成什么,但也许你可以重写字段的 asHtml 方法?
I'm not quite sure what you're trying to accomplish, but maybe you could override the asHtml method of the fields instead?