2015-03-24 2 views
0

Когда я нажимаю на ячейку календаря, открываются лайтбокс, а затем автоматически закрываются. Ниже мой код., когда я нажимаю на лайтбокс ячейки календаря, открываю и затем автоматически закрываю

scheduler.attachEvent ("onEmptyClick", функция (идентификатор, е) {

 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);** 
        } 
       }); 
     }); 

ответ

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); 
    } 
}); 
+0

Его работа. –

Смежные вопросы