datagridfield 在灵活的网络内容类型编辑器中不可见
我已将collective.z3cform.datagridfield
添加到我的构建中,在我的站点设置中将其视为活动状态;但是,我无法通过 Web 编辑器为灵巧内容类型添加 datagridfield
类型的字段。我缺少什么?
I've added collective.z3cform.datagridfield
to my buildout, see it as active in my site settings; however, I cannot add a field of type datagridfield
via the through-the-web editor for a dexterity content type. What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
扩展 vangheem 的答案:您可以通过提供字段工厂来提供对 Collective.z3cform.datagridfield 的支持,但这将是一个黑客。
原因是,
collective.z3cform.datagridfield.row.DictRow
需要一个定义表行的模式。一旦呈现,这将成为子表单。在这种情况下,模式编辑器将需要根据(表)模式的字段类型来询问您。根据您所追求的解决方案,您可能可以通过使用固定表架构实现字段工厂来摆脱困境,如下所示:
请查看:
plone.schemaeditor.fields。 py
了解有关现场工厂的更多信息。这将为您提供适合您的内容类型的基本数据网格。缺少的是小部件,据我所知,您目前无法将其声明为小部件。
Extending vangheem's answer: You can provide support for collective.z3cform.datagridfield by providing a field factory, but it will be a hack.
Reason being is, that the
collective.z3cform.datagridfield.row.DictRow
expects a schema, defining the table rows. This becomes a subform once rendered. The schemaeditor in this instance would need to ask you depending on the field type also for the (table-) schema.Depending on what solution you are after, you might be able to get away by implementing a field factory with a fixed table schema like this:
Please have a look into:
plone.schemaeditor.fields.py
for more information about the field factory.This will get you a basic datagrid for your content type. What's missing is the widget, which you currently can't be declared AFAIK.