Meteor JS - 客户端集合似乎是空的(Meteor JS - Client Collection seems to be empty)
自从我使用Meteor或涉足UI世界以来已经很长时间了,所以如果这是一个糟糕的问题,请原谅我。
API / main.js:
export const Nodes = new Meteor.Collection("nodes"); export const Links = new Meteor.Collection("links");
服务器/ main.js
import { Links, Nodes } from '../api/main.js'; Meteor.startup(() => { // code to run on server at startup } Meteor.methods({ traverseDocument: function traverseDocument(documentKey) { // ... do stuff ... Links.insert( data.links ); Nodes.insert( data.nodes ); return data; } }
客户机/ main.js
import { Links, Nodes } from '../api/main.js'; import './main.html'; Meteor.startup(function () { // Fetch data via a call Meteor.call("traverseDocument", 'NTD000000228506', function (error, results) {}); }); Template.viz.rendered = function () { console.log(Nodes.find()); // <-- LocalConnection.Cursor() console.log(Nodes.find().fetch()); // <-- This is empty [] console.log(Nodes._collection._docs._map); // <-- This returns Object{} }
我尝试过:1。发布/订阅2.我尝试了一个辅助函数3.我已将Meteor.Call()移动到客户端启动函数中
所以这现在似乎更接近工作了。
原始问题现在改为 - 为什么find()。fetch()返回一个空数组?
也许我应该发一个新问题并将其标记为固定?
Its been a long time since I used Meteor or dabbled in the UI world for that matter, so forgive me if this is poor question.
api/main.js:
export const Nodes = new Meteor.Collection("nodes"); export const Links = new Meteor.Collection("links");
server/main.js
import { Links, Nodes } from '../api/main.js'; Meteor.startup(() => { // code to run on server at startup } Meteor.methods({ traverseDocument: function traverseDocument(documentKey) { // ... do stuff ... Links.insert( data.links ); Nodes.insert( data.nodes ); return data; } }
client/main.js
import { Links, Nodes } from '../api/main.js'; import './main.html'; Meteor.startup(function () { // Fetch data via a call Meteor.call("traverseDocument", 'NTD000000228506', function (error, results) {}); }); Template.viz.rendered = function () { console.log(Nodes.find()); // <-- LocalConnection.Cursor() console.log(Nodes.find().fetch()); // <-- This is empty [] console.log(Nodes._collection._docs._map); // <-- This returns Object{} }
I've tried: 1. Publish/Subscribe 2. I tried a helper function 3. I Have moved the Meteor.Call() into the client startup function
So this now seems to be closer to working.
The original question changes now to - Why does the find().fetch() return an empty array ?
Maybe I should post a new question and mark this one as fixed ?
原文:https://stackoverflow.com/questions/39124653
最满意答案
Fullcalendar具有丰富的回调设置来配置:
你应该使用eventRender来修改它(隐藏已经构造的标题是它的最佳方式)。 不要尝试构造新元素并替换原始元素
相同的
eventRender
,您可以在其中添加CSS或类,然后更改每个事件或直接从CSS议程视图根本没有时间段,它是按时间排序的列表,不代表事件之间的时间长度比例。 如果您不想基于时间的视图,那么尝试单日视图并将slotDuration设置为尽可能接近,即使在按钮或键绑定的情况下也是如此。 +设置
slotDuration
,如果您不支持添加事件,请同时更改snapDurationFullcalendar have rich callback set to configure:
You should use eventRender to modify it (hide title in already constructed is best way of it). Do not try construct new element and replace original
The same
eventRender
where you can add CSS or class and then change per event or direct from CSSAgenda view does not have time slots at all, it is time-ordered list which does not represent proportion of time-lenght between events. If you wan't time based view, then try singe day view and set slotDuration as close as you want, even on the fly with buttons or keybind. + when setting
slotDuration
, if you wan't support adding events, change also snapDuration
相关问答
更多-
您问: “是否可以缩放足够的时间增量以防止垂直滚动?” 从技术上来说,答案是否定的,因为你无法控制用户视口的高度。 换句话说,您无法预测最终用户屏幕的大小。 如果他们真的想要,可以决定在高度为20px的窗口中查看网站。 不太可能,但理论上可行。 但是,您可以做出现实的假设,用户可能做什么以及准备支持哪些内容。 而且你在fullCalendar中也有一些工具可以帮助你。 如果您对文档进行了更深入的研究,则可能会发现以下内容: 1)您可以使用height选项为整个日历设置固定的像素高度。 https://ful ...
-
您可以使用前缀ARG来专门选择您的TODO项目(然后您仍然可以在您的待办事项列表中显示项目): C-u AGENDA-HOTKEY t TODO RET You could use a prefix ARG to specifically select your TODO items only (then you still keep the possibility to show projects also in your todo list): C-u AGENDA-HOTKEY t TODO RET ...
-
一般而言,组织模式与基于ISO的西方日历之外的日历不能很好地(或根本不)处理。 如果要在bbdb中存储格式不同的日期,可以自定义org-bbdb-extract-date-fun 。 您必须编写自己的函数来解析希伯来语日期并返回(月份日)。 这将允许您使用希伯来语日期使用bbdb数据库,但它不会出现例如使用希伯来语日期的议程输出。 这是一个更难的问题,特别是因为ISO日历假设渗透到组织模式代码库中。 编辑:这是一个函数,它接受像“Heshvan 17,5776”这样的字符串作为参数,并产生一个组织可以使用的 ...
-
django:自定义ModelMultipleChoiceField的显示(django: customizing display of ModelMultipleChoiceField)[2022-05-29]
字段类有一个方法label_from_instance ,它控制对象的表示方式。 您可以在自己的字段类中覆盖它: from django.forms.models import ModelMultipleChoiceField class MyMultipleModelChoiceField(ModelMultipleChoiceField): def label_from_instance(self, obj): return "%s | %s" % (obj.name, ob ... -
在对org-batch-agenda的调用中使用不同的命令键参数,例如: (org-batch-agenda“a”) org-batch-agenda的文档字符串表示: 如果CMD-KEY是长度为1的字符串,则将其用作'org-agenda-custom-commands'中的键并触发此命令。 如果你不喜欢任何现有的命令,你可以随时定义自己的议程自定义命令并附上一个键; 那么你可以用这个密钥来调用org-batch-agenda 。 Use a different command key argument ...
-
Fullcalendar具有丰富的回调设置来配置: 你应该使用eventRender来修改它(隐藏已经构造的标题是它的最佳方式)。 不要尝试构造新元素并替换原始元素 相同的eventRender ,您可以在其中添加CSS或类,然后更改每个事件或直接从CSS 议程视图根本没有时间段,它是按时间排序的列表,不代表事件之间的时间长度比例。 如果您不想基于时间的视图,那么尝试单日视图并将slotDuration设置为尽可能接近,即使在按钮或键绑定的情况下也是如此。 +设置slotDuration ,如果您不支持添加 ...
-
您需要做的就是使用不同的皮肤实现来调用setSkin。 但也有一个AgendaSkinSwitcher ......多么方便:-) https://github.com/JFXtras/jfxtras/blob/8.0/jfxtras-agenda/src/main/java/jfxtras/scene/control/agenda/AgendaSkinSwitcher.java All you need to do is call setSkin with a different skin impleme ...
-
这应该工作: (add-hook 'after-init-hook (lambda () (org-agenda nil "w"))) @robust:您可以通过帮助页面获取更多信息,以便非交互式地使用org-agenda ( Ch f org-agenda ); 请注意, lambda中的原始(interactive)是不需要的,因此我将其编辑出来。 第一个可选参数是前缀参数,因此传递给它一个占位符,但第二个( ORG-KEYS )是你想要设置为你感兴趣的键( "w" )的那个。 你将对org-agen ...
-
变量org-agenda-time-grid的规格最近已经改变。 如果您使用的是最新版本的组织,那么您的设置不正确。 尝试使用Ch v org-agenda-time-grid RET读取变量的文档。 我不知道0 16 (org-heading t)在旧设置中做了什么,但也许你可以试试 (setq org-agenda-time-grid (quote ((daily today remove-match) ...
-
当前缓冲区的日程视图(Agenda view of the current buffer)[2023-12-11]
对我来说,最明显的不是创建额外的议程视图,而只是简单地调用该缓冲区上的任何现有视图(使用诸如Cc a < a的调用将视图限制为当前缓冲区,其中<当前缓冲区的限制)。 如果您仍想为当前缓冲区创建额外的议程视图,我不确定是否可以使用所有命令。 当然,调用occur-tree将在当前缓冲区上工作。 关于todo等不确定。 For me, the most obvious is NOT to create an extra agenda view, and simply call any existing view ...