全日历调度程序中的资源数组未在IE中填充11
问题描述:
我正在使用完整的日历调度程序(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");
}
});
答
调试小时后我发现这是怎么回事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') + ",";
});
在IE中的任何控制台错误? – ADyson
@ADYSON没有错误,也只有最后选定的下拉列表被添加为IE 11中的资源,但不是所有选定的下拉列表,为什么? – user2841408
我们可以看到下拉菜单的HTML吗? jQuery选择器是否会选择最后一个,是这个原因吗?你是否浏览了代码,看看问题出在哪里? – ADyson