Unpopulated fields between two Schemas keystone.js

三世轮回 提交于 2019-12-12 23:23:18

问题


I have two models: Entity and Cabinet. Entity model can have multiple cabinets. One cabinet can have one Entity object. In my admin UI when I create Cabinet I specify the Entity which the cabinet belongs to.

I have linked Entity to Cabinets and Cabinets to Entity like this:

models/Entity.js

Entity.add({ name: { type: Types.Text, initial: true, label: 'Име' }, cabinets: { type: Types.Relationship, ref: 'Cabinet', many: true }, })

models/Cabinet.js

Cabinet.add({ entity_id: { type: Types.Relationship, ref: 'Entity'}, name: { type: Types.Text, initial: true } })

When I save a new Cabinet and go to Entity list, I expect to see populated cabinet ( I just created ) in the column Cabinets The column Cabinets in the Entity list view is empty.

Is this a bug in keystone.js or I have missed something?


回答1:


What you've done here is just create two different models. That being said once you create a new Cabinet you should be able to go into Entities and select that Cabinet from a search/dropdown.

Since this was asked two months ago I'm going to assume you've solved what you were looking for and moved on... but if you are still stuck could you clarify what the rest of your models have and confirm that the Cabinet that you've saved is actually generating?



来源:https://stackoverflow.com/questions/52817895/unpopulated-fields-between-two-schemas-keystone-js

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