我在我的應用程序中使用aslagle中的反應性表格軟件包,我想創建內嵌編輯,我搜索了一下,發現有流星的x-editable軟件包,所以我怎樣才能使用aslagle:工作人員的反應表包:x-editable-reactive-template包?使用軟件包aslagle:使用X-editable的反應表
我嘗試這樣做:
反應,表設置:
tableSettings: function() {
return {
collection: fLogCollection,
rowsPerPage: 10,
showFilter: true,
fields: [
{ key: 'name', label: 'Name'},
{ key: 'amount',
label: 'Amount',
tmpl: Template.xEditableAmount
},
{ key: 'cashFrom', label: 'Cash From'},
{ key: 'dateIs', label: 'Date', sortOrder: 0, sortDirection: 'descending'},
{ key: 'controls', label: 'Controls', fn: function() {
return new Spacebars.SafeString(
"<button class='editFlog'><span class='glyphicon glyphicon-pencil'></span> </button>"+
"<button class='delete'><span class='glyphicon glyphicon-remove'></span> </button>"
); } },
{ key: 'createdAt', label: 'createdAt', hidden: true },
],
};
},
xEditableAmount模板:
<template name="xEditableAmount">
<a href="#" id="amount" data-type="text" class="editable" data-title="Enter the new amount">{{amount}}</a>
</template>
此代碼來獲取X編輯呈現:
Template.fLog.onRendered(function() {
this.$('.editable').editable({
success: function (response, newValue) {
if(response.status == 'error') return response.msg; //msg will be shown in editable form
else Meteor.call('flog.edit2', this._id, newValue);
},
});
});
我成功地使X-編輯渲染,但
我在獲得與收集的新值更新領域的失敗...
您是否堅持使用x-editable?使用反應表創建內聯可編輯表格非常簡單。 – Jeremiah
實際上,我被困在找到一種方法來使x-editable軟件包能夠與反應表軟件包一起工作 – MJO