【问题标题】:Full Calendar and CakePHP 3.x cannot get events to show on calendar完整日历和 CakePHP 3.x 无法在日历上显示事件
【发布时间】:2016-01-02 03:10:14
【问题描述】:

只有在我的 ready.js 文件的事件部分中硬编码 json 数组时,我才能在日历上获取事件。如果我使用 url,那么它们将不会显示。

如果我浏览到带有事件的 url,它会显示 json 数组。

这是数组中的一个示例事件:

[{"id":10,"title":"Utah REIA Monthly Meeting--Your Investor Toolbox provided with the New Website Launch","start":"2015-11-24T18:30:00-0700","end":"2015-11-24T20:30:00-0700","allDay":false,"url":"\/events\/view\/10","details":"\u003Cp\u003E\u003Cspan\u003EAre you a real estate investor who is looking for\u003C\/span\u003E\u003C\/p\u003E\n\u003Col\u003E\n\t\u003Cli\u003EMore education\u003C\/li\u003E\n\t\u003Cli\u003EIndividuals to connect and network with\u003C\/li\u003E\n\t\u003Cli\u003EDiscounts and special offers from retailers you frequent most\u003C\/li\u003E\n\u003C\/ol\u003E\n\n\u003Cp\u003E\u003Cspan\u003EThe Utah REIA has listened and has created a custom website to meet the needs of the real estate investor. This new website will:\u003C\/span\u003E\u003C\/p\u003E\n\u003Col\u003E\n\t\u003Cli\u003EShowcase discounts and special offers from favorite retailers including, but not limited to, Home Depot, Office Max, and Western Reporting.\u003C\/li\u003E\n\t\u003Cli\u003EProvide access to meeting videos and Powerpoint presentations dating back to the inception of the Utah REIA\u003C\/li\u003E\n\t\u003Cli\u003EAllow for Vendors to customize Business Directory listings as well as provide access to post special discounts and incentives\u003C\/li\u003E\n\t\u003Cli\u003EContinue to provide access\u003Cspan class=\u0022text_exposed_show\u0022\u003E to the Utah REIA Library--an archive of 27 folders filled with publications surrounding topics including, but are not limited to 1031 Exchanges, Foreclosures, Forms & Contracts, and Business Management.\u003C\/li\u003E\n\t\u003Cli\u003EProvide a way to connect easily with members of the Utah REIA\u003C\/li\u003E\n\u003C\/ol\u003E\n\n\u003Cp\u003ECome and learn how all of this works so that you can take advantage of these amazing tools as well as provide us with feedback to help us help meet your needs better!\u003C\/p\u003E","className":"Blue"}]

如果我复制该数组并将其放在我的 js 文件中,它将显示事件,但如果我使用 url,则不会。

Ready.js:

jQuery(document).ready(function( $ ) {

    // page is now ready, initialize the calendar...
    $('#calendar').fullCalendar({

        header: {
            left:   'title',
            center: '',
            right:  'today agendaDay,agendaWeek,month prev,next'
        },
        defaultView: 'month',
        fixedWeekCount: false,
        scrollTime: "08:00:00",
        aspectRatio: 2,
        editable: adminEdit,
        events: plgFcRoot + 'events/feed',
        eventRender: function(event, element) {
            element.qtip({
                content: event.details,
                position: { 
                    target: 'mouse',
                    adjust: {
                        x: 10,
                        y: -5
                    }
                },
                style: {
                    name: 'light',
                    tip: 'leftTop'
                }
            });
        }
    })
});

【问题讨论】:

  • 我完全没有使用完整日历的经验,所以这里只是一个提示,也许可以帮助您入门:检查您的浏览器网络和日志控制台,并查找可能的错误。另外,对于以后的问题,尽量选择更合适的标签(几个小时后重新标签不会引起太多关注),使用 3 个 CakePHP 版本标签没有帮助,你最好只选择一个与版本相关的标签,并使用其他的来进一步指定使用的技术,这样您就更有可能从了解您正在使用的软件的人那里获得帮助。
  • @ndm 谢谢你的提示。我已经检查了控制台、网络和日志文件夹下的文件是否有蛋糕,并且没有相关的错误或警告。

标签: javascript jquery cakephp fullcalendar cakephp-3.x


【解决方案1】:

我正在使用 $this->loadComponent('RequestHandler');在我的 App Controller 中,这是为整个应用程序启用数据视图并导致事件不呈现。我将它从我的 App Controller 中取出,它现在正在显示事件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-15
    相关资源
    最近更新 更多