单击上一个按钮将检索上一个日期的集合。例如,如果当前日期是 2013-04-05,则上一个按钮将检索 2013-04-04 的所有集合,依此类推。但是,自动更新不起作用。新的事件集合从未出现并且发生异常。
此外,如果我尝试创建新事件,我也会遇到此错误。只有刷新页面,我才能看到集合中的新事件。
错误
Exception from Deps recompute: Error: Error copying attribute ',': Error: InvalidCharacterError: DOM Exception 5
at Function.Spark._Patcher._copyAttributes (http://0.0.0.0:3000/packages/spark/patch.js? e76412b922e47b6c2c1f890e3bc10fd13bdecfef:494:19)
at Spark._Patcher.match (http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:249:26)
at http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:61:23
at visitNodes (http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:17:11)
at Object.Spark._patch (http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:31:3)
at http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:638:13
at LiveRange.operate (http://0.0.0.0:3000/packages/liverange/liverange.js?5e6bc5ba11645802c3440658c75fcc2277537dd1:458:9)
at http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:633:11
at withEventGuard (http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:103:16)
at Object.Spark.renderToRange (http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:632:3) logging.js:40
Exception from Deps afterFlush function: TypeError: Cannot read property 'previousSibling' of null
at findPosition (http://0.0.0.0:3000/packages/liverange/liverange.js?5e6bc5ba11645802c3440658c75fcc2277537dd1:177:12)
at new LiveRange (http://0.0.0.0:3000/packages/liverange/liverange.js?5e6bc5ba11645802c3440658c75fcc2277537dd1:126:18)
at notifyWatchers (http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:86:19)
at http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:404:5
at _.extend.flush (http://0.0.0.0:3000/packages/deps/deps.js?651e87591167f4286e96438ff2566ba3357bff99:231:11)
查找事件列表的代码,else下的代码是相关部分
Template.event_manager.list = () ->
if (Session.get("events_toggl"))
Events.find({user_id: Meteor.userId()}, {sort: {seconds: 1}})
else
d = Session.get("eventnav")
start = moment().subtract("days",d).startOf("day")._d
end = moment().subtract("days", d).endOf("end")._d
Events.find({user_id: Meteor.userId(), date: {$gte: start, $lt: end} })
单击上一个将触发上面列表功能中的更新
'click #previous' : () ->
d = Session.get("eventnav")
d += 1
Session.set("eventnav", d)
我们决定渲染事件列表的部分
{{#each list}}
{{> event}}
{{/each}}
个别活动的模板
<template name="event">
<tr class={{status}}>
<td>{{seconds}}</td>
<td><p id="date-{{_id}}" class="date">{{date}}</p></td>
<td><p id="name-{{_id}}" class="name">{{name}}</p></td>
<td><input type="button" id="select" value="select" /><br /><br /><input type="button" id="destroy" value="delete" /></td>
</tr>
</template>