Javascript Meteor Autoform不会更新集合
我有一个问题,我的更新和更新pushArray没有真正更新或向数组中添加内容 我的模板是:Javascript Meteor Autoform不会更新集合,javascript,meteor,meteor-autoform,Javascript,Meteor,Meteor Autoform,我有一个问题,我的更新和更新pushArray没有真正更新或向数组中添加内容 我的模板是: <template name="PersonShow"> <div class="container"> <div class="user-data"> <h2>{{name}}</h2> {{> quickForm id="PersonShow" type="update" collection="
<template name="PersonShow">
<div class="container">
<div class="user-data">
<h2>{{name}}</h2>
{{> quickForm id="PersonShow" type="update" collection="Registry" doc=this fields="isActiveEmployee"}}
</div>
<div class="device-data">
{{#each device}}
<h3><p>Device: {{type}}</p></h3>
<h3><p>Quantity: {{quantity}}</p></h3>
{{#autoForm id="PersonShow" type="update" collection="Registry" doc=this}}
{{> afQuickField name="device.0.isInUse"}}
{{> afQuickField name="comment"}}
<button type="submit" class="btn btn-primary">Submit</button>
{{/autoForm}}
{{/each}}
</div>
<div class="add-new-device">
{{> quickForm id="PersonShow" type="update-pushArray" collection="Registry" doc=this scope="device"}}
</div>
</div>
</template>
当我按下update/update pushArray时,实际上什么也没有发生,没有任何东西被发送到集合
如果我这样做,更新会起作用:
{{>afquickfieldname=device}},但我只想更新数组中的一个特定字段
此外,对于更新pushArray,我希望将内容添加到我的阵列设备中
有人知道这有什么问题吗?问题与模板有关。当我将每个表单放在不同的模板中时,问题就解决了。您能粘贴路由代码吗?您是如何将路由中的数据发送到表单的?我的意思是在博士=这个。我问这个问题是因为我在检索数据并在要更新的字段中显示数据时遇到问题。
Registry = new Mongo.Collection("registry");
Registry.attachSchema(new SimpleSchema({
name: {
type: String,
label: "First and lastname",
max: 200,
optional: false
},
device: {
type: Array,
optional: true
},
'device.$': {
type: Object
},
'device.$.type': {
type: String
},
'device.$.isInUse': {
type: String,
optional: true,
autoform: {
options: [
{label: "Yes", value: "Yes"},
{label: "No", value: "No"}
]
}
},
'device.$.serialNumber': {
type: String,
optional: true
},
'device.$.quantity': {
type: Number,
min: 0
},
isActiveEmployee: {
type: String,
optional: false,
autoform: {
options: [
{label: "Yes", value: "Yes"},
{label: "No", value: "No"}
]
}
},
comment: {
type: String,
label: "Comments",
optional: true,
max: 1000
},
}));