模态解雇后为Zabuto Calendar重新加载AJAX数据 [英] reloading AJAX data for Zabuto Calendar after modal dismissal

查看:145
本文介绍了模态解雇后为Zabuto Calendar重新加载AJAX数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为公司建立时间管理系统.

I am making a time management system for a company.

我将Zabuto Calendar与User Frosting结合使用,这两个项目都很出色.

I used Zabuto Calendar in conjunction with User Frosting, both very excellent projects.

但是,我正在努力让Zabuto在模态解雇中重新加载JSON数据.

However, I am struggling to get Zabuto to reload it's JSON data on a modal dismissal.

如果您想像一下,在为日历上的特定日期调用onclick并输入值之后,用户可能想要关闭模式窗口并继续到下一个日期.

If you imagine, after the onclick is called for a specific date on the calendar, and values are entered, the user would want to close the modal window, and continue to the next date.

月度日历视图以不同等级的颜色显示每个日期,以表示一天是否有事件.

The monthly calendar view displays each date with various grades of color to represent whether the day has events or not.

当用户关闭模式时,日历不会更新其JSON数据.

When the user dismisses the modal, the calendar does not update its JSON data.

http://zabuto.com/dev/calendar/examples/show_data.html

这里是zabuto日历工作原理的一个示例^^

Here is an example of how zabuto calendar works ^^

$("#ts-calendar").zabuto_calendar({
    action: function () {
        return myDateFunction(this.id, false);
    },
    action_nav: function () {
        return myNavFunction(this.id);
    },
    ajax: {
        url: "/api/sql/show_data.php?action=1&user=<? echo $loggedInUser->user_id; ?>",
        modal: true
    },
    show_days: true, 
    weekstartson: 0,
});

推荐答案

好的,所以我想这是一个足够的解决方法,因为原始代码已经利用AJAX加载了数据,所以重新加载数据的一种简单方法是重新加载日历.

Okay, so I guess this is a sufficient workaround, since the original code already utilises AJAX to load data, a simple way to reload the data would be to reload the calendar.

因此,如果有人遇到同样的问题,只需将您的日历代码/脚本复制到一个新文件中,然后将其加载到DOM上即可,然后您可以触发该函数以在需要时加载日历.

So if anyone is struggling with the same issue, just copy your calendar code / script into a new file, load it on DOM ready, and then you can trigger the function to load the calendar whenever you need.

您需要将模式中的月份和年份传递到日历,就好像您正在使用与当前月份不同的月份一样,日历将重新加载到当前月份,而不是您打开模式所用的月份

You will need to pass the month and year from the modal to the calendar as if you are working on a different month to the current month, the calendar will reload to the current month instead of the one you have the modal open on.

希望这会有所帮助.

这篇关于模态解雇后为Zabuto Calendar重新加载AJAX数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆