OnCellClick running when an event is clicked

I have the following code…

            onEventClick: function (events) {
            dmx.parse('sc_tripbit_get.load({tripbit_id: '+ events.event.id +'})');
            dmx.parse('modal_tripbit_show.show()');
        },
        onCellClick: function(events){
            var new_date = new Date(events.date);
            new_date = moment(new_date).format("Y-MM-DD HH:mm:ss");
            dmx.parse('modal_tripbit.form_tripbit.start.setValue("' + new_date + '")');
            dmx.parse('modal_tripbit.show()');
        }

When I click an event both the modal_tripbit_show and the modal_tripbit modals open (show is on top).

Hi @heather,

This is caused by the fact that both the onEventClick and onCellClick events run on event click. Here you can check when and which event fires: https://demo.mobiscroll.com/jquery/eventcalendar/event-hooks

Because onEventClick runs first, you can handle this case with a custom flag in onCellClick event.

1 Like