首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Meteor Autoform不更新集合

Meteor Autoform不更新集合
EN

Stack Overflow用户
提问于 2015-10-06 15:48:12
回答 1查看 126关注 0票数 0

我遇到了问题,我的update和update-pushArray并没有真正更新或添加一些东西到我的数组中。

我的模板是:

代码语言:javascript
复制
<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>

和我的收藏品:

代码语言:javascript
复制
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
  },
}));

当我按下update/update-pushArray时,什么也没有发生,没有任何东西被发送到集合。

如果我这样做,更新可以正常工作:

{{> afQuickField name="device"}},但我只想更新数组中的一个特定字段。

另外,对于update- Also数组,我想将内容添加到数组device

有人能看出这有什么问题吗?

EN

回答 1

Stack Overflow用户

发布于 2015-10-06 19:47:05

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32964469

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档