带有数据表的流星:Meteor._atFlush TypeError [英] Meteor with DataTables: Meteor._atFlush TypeError

查看:10
本文介绍了带有数据表的流星:Meteor._atFlush TypeError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 DataTables(通过 mrt add datatables)与 Meteor 一起使用.我曾多次尝试将 $('#mytableid').dataTable() 添加到 Meteor.subscribe 回调,Meteor.autorunMeteor.startupTemplate.mytemplate.rendered -- 都导致以下异常和 表中无可用数据 消息.>

有什么指点吗?

 来自 Meteor._atFlush 的异常:TypeError:无法调用 null 的方法insertBefore"在 http://localhost:3000/packages/liverange/liverange.js?bc1d62454d1fefbec95201344b27a7a5a7356293:405:27在 LiveRange.operate (http://localhost:3000/packages/liverange/liverange.js?bc1d62454d1fefbec95201344b27a7a5a7356293:459:11)在 LiveRange.replaceContents (http://localhost:3000/packages/liverange/liverange.js?bc1d62454d1fefbec95201344b27a7a5a7356293:403:17)在 http://localhost:3000/packages/spark/spark.js?c202b31550c71828e583606c7a5e233ae9ca50e9:996:37在 withEventGuard (http://localhost:3000/packages/spark/spark.js?c202b31550c71828e583606c7a5e233ae9ca50e9:105:16)在 http://localhost:3000/packages/spark/spark.js?c202b31550c71828e583606c7a5e233ae9ca50e9:981:9在 http://localhost:3000/packages/deps/deps-utils.js?f3fceedcb1921afe2b17e4dbd9d4c007f409eebb:106:13在 http://localhost:3000/packages/deps/deps.js?1df0a05d3ec8fd21f591cfc485e7b03d2e2b6a01:71:15在 Array.forEach(本机)在 Function._.each._.forEach (http://localhost:3000/packages/underscore/underscore.js?47479149fe12fc56685a9de90c5a9903390cb451:79:11)

更新:可能与这个问题,为此找到的最佳解决方案是为每一行调用 dataTable() —— 在这种情况下并不理想,而且鉴于行的数量非常多,这对我来说可能是灾难性的.

解决方案

Dror 的答案无疑是正确的开始.这是我目前看到的最佳实践:

HTML