2017-08-17 19 views
0

我正在使用完整的日曆調度程序(1.6.2),並且正在從某些下拉菜單中檢索資源並創建數組和日曆調度程序。資源已成功添加到Firefox中,但在IE 11中只添加了最後選擇的下拉列表,下面是我的代碼。我缺少什麼或在完整日曆中是否存在任何錯誤。全日曆調度程序中的資源數組未在IE中填充11

$("#schedule_employees > option:selected").each(function() { 
    var id = $(this).attr('id'); 
    var title = $(this).text(); 
    item = {} 
    item.id = id; 
    item.title = title; 
    employees.push(item); 
    employee2 = employee2 + $(this).attr('id') + ","; 
}); 

if (employees.length == 0) { 
    alert("Please select the employees"); 
    return false; 
} 

$('#calendar').fullCalendar('destroy'); 
$('#calendar').fullCalendar({ 
    aspectRatio: '1', 
    height: "auto", 
    scrollTime: '00:00', 
    header: { 
     left: 'prev,next today', 
     center: 'title', 
     right: 'Schedule,agendaDays' 
    }, 
    groupByResource: "true", 
    defaultView: 'Schedule', 
    titleRangeSeparator: ' - ', 
    allDaySlot: false, 
    timeFormat: 'HH:mm', 
    views: { 
     agendaDays: { 
      type: 'agenda', 
      slotLabelFormat: 'HH:mm', 
      //groupByDateAndResource: true, 
      groupByResource: true, 
      buttonText: 'Agenda 2 days', 
      duration: { 
       days: 2 
      }, 
     }, 
     Schedule: { 
      type: 'timeline', 
      slotDuration: '04:00:00', 
      slotLabelInterval: { 
       hours: 4 
      }, 
      buttonText: 'Schedule', 
      visibleRange: { 
       start: moment($("#start_Date input").val(), 'MM/DD/YYYY HH:mm').format('YYYY-MM-DD'), 
       end: moment($("#end_Date input").val(), 'MM/DD/YYYY HH:mm').add(1, 'days').format('YYYY-MM-DD') 
      } 
     } 
    }, 
    resourceLabelText: 'Employees', 
    resourceAreaWidth: '25%', 
    resources: employees, 
    viewRender: function(view, element) { 
     renderScheduleReport(employee2); 
    }, 
    eventClick: function(event, jsEvent, view) { 
     alert("hi"); 
    } 
}); 
+0

在IE中的任何控制檯錯誤? – ADyson

+0

@ADYSON沒有錯誤,也只有最後選定的下拉列表被添加爲IE 11中的資源,但不是所有選定的下拉列表,爲什麼? – user2841408

+0

我們可以看到下拉菜單的HTML嗎? jQuery選擇器是否會選擇最後一個,是這個原因嗎?你是否瀏覽了代碼,看看問題出在哪裏? – ADyson

回答

1

調試小時後我發現這是怎麼回事wrong.In下面的循環員工陣列包含每個迭代相同的元素,取代現有的一個,這樣到底變量包含相同elements.Don't知道爲什麼IE總是會造成麻煩。

$("#schedule_employees > option:selected").each(function() { 
    var id = $(this).attr('id'); 
    var title = $(this).text(); 

變化下面線從

item = {} //this is causing issue 

var item = {};

item.id = id; 
    item.title = title; 
    employees.push(item); 
    employee2 = employee2 + $(this).attr('id') + ","; 
});