当我点击日历单元格灯箱打开然后自动关闭

时间:2015-03-24 11:21:37

标签: scheduler dhtmlx

当我点击日历单元格时,灯箱打开然后自动关闭。下面是我的代码。

scheduler.attachEvent(" onEmptyClick",function(id,e){

        var action_data = scheduler.getActionData(e);

            var event = {
                start_date: action_data.date,
                end_date: scheduler.date.add(action_data.date, 5, "minute"),
                stylist_id: action_data.section
            };
             var eventId = scheduler.addEventNow(event);

          var profId = event.stylist_id;

            $.ajax({
                    type: "POST",
                    dataType: 'json',
                    url: 'loadMultipleServices',
                    data: "prof_id=" + profId,
                    success: function(data) {
                        service_section = JSON.parse(data.services);
                        lightBoxWithAddedServices = scheduler.config.lightbox.sections = [
                            {name: "Event", height: 30, map_to: "text", type: "textarea", focus: true},
                            {name: "Professionals", height: 23, type: "select", options: sections, map_to: "stylist_id"},
                            {name: "Clients", height: 23, type: "select", options: client_section, map_to: "client_id"},
                            {name: "Services", height: 23, type: "select", options: service_section, map_to: "service_id"},
                            {name: "Description", height: 40, map_to: "description", type: "textarea", focus: true},
                            {name: "Owner", height: 23, type: "textarea", map_to: "owner_id"},
                            {name: "time", height: 72, type: "time", map_to: "auto"}
                        ];

                        **scheduler.resetLightbox();**
                        **scheduler.showLightbox(eventId);**
                    }
                });
        });

1 个答案:

答案 0 :(得分:0)

在一个打开时调用scheduler.resetLightbox会导致此问题。尝试从ajax回调创建事件,而无需重新打开表单。 即

之后的事情
var action_data = scheduler.getActionData(e);

$.ajax({
    type: "POST",
    dataType: 'json',
    url: 'loadMultipleServices',
    data: "prof_id=" + action_data.section,
    success: function(data) {
        service_section = JSON.parse(data.services);
        lightBoxWithAddedServices = scheduler.config.lightbox.sections = [
            {name: "Event", height: 30, map_to: "text", type: "textarea", focus: true},
            {name: "Professionals", height: 23, type: "select", options: sections, map_to: "stylist_id"},
            {name: "Clients", height: 23, type: "select", options: client_section, map_to: "client_id"},
            {name: "Services", height: 23, type: "select", options: service_section, map_to: "service_id"},
            {name: "Description", height: 40, map_to: "description", type: "textarea", focus: true},
            {name: "Owner", height: 23, type: "textarea", map_to: "owner_id"},
            {name: "time", height: 72, type: "time", map_to: "auto"}
        ];

        scheduler.resetLightbox();

        var event = {
            start_date: action_data.date,
            end_date: scheduler.date.add(action_data.date, 5, "minute"),
            stylist_id: action_data.section
        };

        scheduler.addEventNow(event);
    }
});
相关问题