流星Autoform不更新集合

问题描述:

我有问题,我的更新和update-pushArray不真正更新或添加一些东西到我的数组。流星Autoform不更新集合

我的模板是这样的:

<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> 

和我的收藏:当我按下更新/更新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 
    }, 
})); 

没有真的发生。

{{> afQuickField name="device"}}但我只想在我的阵列更新一个特定的字段:如果我不喜欢这样

更新工作。

而且对于更新pushArray我想要的东西添加到我的阵列device

任何人能看到什么问题呢?

问题与模板有关。当我将每个表单放在不同的模板中时,问题就解决了。

+0

你可以粘贴你的路由代码,你是如何将数据从路由发送到窗体的?我的意思是在'doc = this'。 我在问这个问题,因为我在检索数据时出现问题,并在更新的字段中显示它们。 [我未解决的问题](http://*.com/questions/32936485/unable-to-get-data-into-the-form-fields-to-update-the-values-meteor-autoform) – Greenhorn