[英]Meteor: Adding sortable with rubaxa:sortable package
我尝试集成rubaxa:sortable
以使列表可排序。
client / helpers.js
Template.getElements.helpers({
children: function() {
return Articles.find({ parent: this._id }, {sort: {order: 1}});
}
});
服务器/publications.js
Meteor.publish('articles', function() { return Articles.find({}, {sort: {slug: 1}}); });
Sortable.collections = 'articles';
模板
<template name="getElements">
<ul class="sortable">
{{#each children}}
{{#sortable items=Articles sortField="order"}}
<li data-id="{{_id}}"><input type="text" name="keyword" value="{{title}}"></li>
{{/sortable}}
{{/each}}
</ul>
</template>
在文档( https://atmospherejs.com/rubaxa/sortable )中,我看到了以下信息:
Client:
{{#sortable items=<collection|cursor|array> sortField="order"}}
Server:
Sortable.collections = <collectionName>; // the name, not the variable
那我在做什么错? 目前,没有显示列表元素。
我不是专家,但是基于集成,这可以解决您的问题。
Server JS更新声明以在[]中包含归类名称。
Sortable.collections = ['articles]];
HTML模板删除以下内容:
{{#每个孩子}}
{{/每}}
问候,文斯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.