Node.js keystonejs显示选择选项取决于选择另一个选择选项

Node.js keystonejs显示选择选项取决于选择另一个选择选项,node.js,keystonejs,Node.js,Keystonejs,我正在尝试在keystone.js应用程序模型中从选择选项中选择与用户在另一个选择选项中选择的内容相关的内容。。 因此,他将从第一个选项中进行选择,第二个选择选项应仅包含与第一个选择选项相关的数据。。 我希望有人能帮助我 非常感谢您应该使用dependsOn选项 例如 type: { type: Types.Select, options: ['TypeOne','TypeTwo','TypeThree TypeFour' ], initial: true }, something: { ty

我正在尝试在keystone.js应用程序模型中从选择选项中选择与用户在另一个选择选项中选择的内容相关的内容。。 因此,他将从第一个选项中进行选择,第二个选择选项应仅包含与第一个选择选项相关的数据。。 我希望有人能帮助我
非常感谢

您应该使用dependsOn选项

例如

type: { type: Types.Select, options: ['TypeOne','TypeTwo','TypeThree TypeFour' ], initial: true },

something: { type: Types.Text, dependsOn: { type: 'TypeThree' }, initial: true },
关系示例-您可以按照逻辑显示某些字段仅在dependsOn条件匹配时显示

Adjustment.add({
type: { type: Types.Select, options: ['Booking','Shipment','Warehouse','Inventory' ], initial: true },
sku: { type: Types.Text, initial: true },
quantity: { type: Types.Number, initial: true, width: 'short' },
keyID: { type: Types.Relationship, ref: 'Order', dependsOn: { type: 'Booking' }, initial: true },
bookingID: { type: Types.Relationship, ref: 'Booking', dependsOn: { type: 'Booking' }, initial: true },
warehouse: { type: Types.Relationship, ref: 'Warehouse', dependsOn: { type: 'Warehouse' }, initial: true },
shipmentID: { type: Types.Text, dependsOn: { type: 'Shipment' }, initial: true },

}))

但我试图通过使用类型使选项成为动态的:关系和对模型的引用。。。。这就是我要面对的技巧我更新了我的原始答案,加入了一个dependsOn用于关系的示例。选项数据可能来自数据库吗?