我在 rails 应用程序中使用 jquery fullcalendar。目前它在月份显示中显示 event.title 字段。我希望它也显示和附加字段 = workorder.wonum
我在 Stackoverflow 上找到了这个解决方案。
eventRender: (event, element) ->
element.find(".fc-event-title").html(event.title + ": <span>" + event.workorder.wonum + "</span>")
该代码显示 event.title,然后显示“未定义”。如果我将 event.workorder.wonum 更改为 event.description --> 就可以了。
我可以通过更改创建 json 的控制器中的 event.title 来做到这一点吗?
像这样的东西(它不起作用):
respond_to do |format|
format.json { render json: @events, :only => [:title => :title + :workworder.wonum] }
end
谢谢!!