按属性分类的当日全日历事件

时间:2019-05-10 21:24:56

标签: jquery fullcalendar fullcalendar-4

我使用的是全日历版本4。当当天发生的事件有所更改时,我想用事件计数更新页面的单独部分:未确认的数量,已确认的数量,在我的代码中的某个日期(称为call_list_date)中取消了多少,等等。

我想知道是否可以使用fullcalendar的方法之一来做到这一点?我目前正在使用eventrender来计数我需要的东西,但是我发现事件渲染已被触发,并且即使我调整大小,将事件悬停在当前日期上等等,这些计数也会更新。

是否有回调或我可以在fullcalendar中使用的东西,只有在用户对事件进行了明确的更改后重新渲染/删除/添加事件时,才会触发该回调。

这是我用来更新计数的内容:

eventRender: function(info) {

            //update call list counts if event on same date
            //only update call list if call list date = date of event!
            var call_list_date = moment($('#call_date').data('call_date_to_pass')).format('YYYY-MM-DD');
            var event_date = moment(info.event.start).format('YYYY-MM-DD');


            if (call_list_date == event_date) {


                var appt_status = info.event.extendedProps.appt_status_id;
                var post_appt_status = info.event.extendedProps.post_appt_status_id;

                //unconfirmed
                if ((appt_status == '2' || appt_status == '9' ||
                    appt_status == '10')  && post_appt_status == null)  {

                    var this_number = $('#unconfirmed_count').text();
                    if (!this_number) {
                        this_number = 0;
                    }
                    var unconfirmed_count = parseInt(this_number);
                    var new_unconfirmed_count = unconfirmed_count + 1;

                    $('#unconfirmed_count').text(new_unconfirmed_count);

                }

                //confirmed
                if (appt_status == '1' && post_appt_status == null)  {

                    var this_number = $('#confirmed_count').text();
                    if (!this_number) {
                        this_number = 0;
                    }
                    var confirmed_count = parseInt(this_number);
                    var new_confirmed_count = confirmed_count + 1;

                    $('#confirmed_count').text(new_confirmed_count);

                }

0 个答案:

没有答案