Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Meteor editabletext无法级联每个_Meteor_Meteor Blaze - Fatal编程技术网

Meteor editabletext无法级联每个

Meteor editabletext无法级联每个,meteor,meteor-blaze,Meteor,Meteor Blaze,我试图使用barbahams的可编辑文本包(babrahams:editable-text-wysiwyg-bootstrap-3)来编辑mongodb中另一个数组中的数组内容,尽管外部数组和内部数组似乎都可以很好地工作(当我把它放在外部并手动将第一个$0设置为0时,当我把任何可编辑文本放在内部时,它根本不起作用 我的模式是: Params = new Mongo.Collection("params"); Params.attachSchema(new SimpleSchema({ t

我试图使用barbahams的可编辑文本包(babrahams:editable-text-wysiwyg-bootstrap-3)来编辑mongodb中另一个数组中的数组内容,尽管外部数组和内部数组似乎都可以很好地工作(当我把它放在外部并手动将第一个$0设置为0时,当我把任何可编辑文本放在内部时,它根本不起作用

我的模式是:

Params = new Mongo.Collection("params");
Params.attachSchema(new SimpleSchema({
    title: {
        type:String,
        label: "title",
    },
    data: {
        type: Array,
        optional: true
    },
    'data.$': {
        type: Object
    },
    'data.$.name': {
        type: String
    },
    'data.$.values': {
        type: Array
    },
    'data.$.values.$': {
        type: String
    },
}));
我的模板是:

<template name="param_edit_form">
    {{#with param}}
        {{#each data}}
            {{#let data_index=@index}}
                {{> editableText context=.. collection='params' field=(get_name @index)}}: <!-- this one works -->
                {{#each values data_index}}
                    <span style="color:#f00;">
                        {{this}} <!-- this one works, it displays the text I want, it's just that it is noe editable -->
                        {{> editableText context=.. collection='params' field=(get_value data_index @index)}}, <!-- this one doesn't work, nor any other editable text -->
                    </span>
                {{/each}}
                        {{> editableText context=.. collection='params' field=(get_value data_index 0)}}, <!-- this one works -->
            {{/let}}
        {{/each}}
    {{/with}}
</template>

PS:我确信我可以使用可编辑的div和事件侦听器等解决这个问题,只是我想知道为什么它不能以这种方式工作。

我在包的GitHub repo上发布了相同的问题,它已经得到了回答,所以我发布了链接:

Template.param_edit_form.helpers({
    param: function(){
        return Params.findOne({_id:Session.get("paramid")});
    },
    // find all visible data
    data: function(){
        if (this.data) {
            return this.data;
        }
    },
    // find all visible values
    values: function()
        if (this.values) {
            return this.values;
        }
    },
    get_name: function(dataIndex){
        return  'data.' + dataIndex + '.name';
    },
    get_value: function(dataIndex, index){
        return  'data.'+dataIndex+'.values.'+index;
    },
});