将集合加载到流星中的快速表单 [英] load collections to a quickform in meteor
本文介绍了将集合加载到流星中的快速表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为payments
集合和memberProfile
创建了两个单独的模式.现在,我需要创建一个快速表单,以便加载与唯一的MemberProfile相关的所有付款.
I created two seperate schemas for payments
collection and memberProfile
. Now I need to create a quickform so I could load all the payments relevant to a unique memberProfile.
//The code for memberPayment collection
MemberProfiles = new Mongo.Collection('memberProfiles');
RecipeSchema = new SimpleSchema({
name: {
type: String,
label: "Name"
},
desc: {
type: String,
label: "Description"
},
payments:{
type: [PaymentSchema],
autoValue: function () {
return Payments.find({ memberId="uniqueId"});
},
defaultValue: function () {
return Payments.find({memberId="uniqueId"});
},
},
// The code for payments collection
PaymentSchema = new SimpleSchema({
name:{
type: String
},
amount:{
type: String
},
memberId:{
type: String
},
});
此代码无效.
推荐答案
似乎缺少架构属性.任何自动表单都需要采用一个架构属性,该属性明确告诉自动表单使用该架构生成必要的表单.在此页中查看使用自动格式的演示.
Looks like you're missing the schema attribute. Any autoform needs to take in a schema attribute that explicitly tells autoform to use that schema to generate the necessary form. Check this page out for demos using autoform.
{{> quickForm collection="theMongoCollection" id="theFormID" schema="theSchemaName" type="typeOfForm" }}
这篇关于将集合加载到流星中的快速表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文