Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/444.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jquery周日历事件的多用户错误_Javascript_Jquery_Calendar_Jquery Week Calendar - Fatal编程技术网

Javascript Jquery周日历事件的多用户错误

Javascript Jquery周日历事件的多用户错误,javascript,jquery,calendar,jquery-week-calendar,Javascript,Jquery,Calendar,Jquery Week Calendar,我使用的是Jquery Week Calendar插件,几乎所有东西都工作正常,但这是:当我将我的用户名数组赋给“users”选项时,它会从数组中加载所有用户,但不会显示任何事件。显然,当我禁用“用户”选项时,所有事件都会加载 我的用户名数组似乎与事件冲突 可能发生什么事?? 让我们看一下代码: 创建事件: var eventData1 = { options: { timeslotsPerHour: 4, timeslotHeight: 20, showAsSe

我使用的是Jquery Week Calendar插件,几乎所有东西都工作正常,但这是:当我将我的用户名数组赋给“users”选项时,它会从数组中加载所有用户,但不会显示任何事件。显然,当我禁用“用户”选项时,所有事件都会加载

我的用户名数组似乎与事件冲突

可能发生什么事??

让我们看一下代码:

创建事件:

var eventData1 = {
    options: {
    timeslotsPerHour: 4,
    timeslotHeight: 20,
    showAsSeparateUsers: true
  },
  events : [
     {'id':1, 'start': new Date(year22, month22, day22, 12), 'end': new Date(year22, month22, day22, 13, 30),'title':'Lunch with Mike'},
     {'id':2, 'start': new Date(year22, month22, day22, 14), 'end': new Date(year22, month22, day22, 14, 45),'title':'Dev Meeting'},
     {'id':3, 'start': new Date(year22, month22, day22 + 1, 18), 'end': new Date(year22, month22, day22 + 1, 18, 45),'title':'Hair cut'},
     {'id':4, 'start': new Date(year22, month22, day22 - 1, 8), 'end': new Date(year22, month22, day22 - 1, 9, 30),'title':'Team breakfast'},
     {'id':5, 'start': new Date(year22, month22, day22 + 1, 14), 'end': new Date(year22, month22, day22 + 1, 15),'title':'Product showcase'}
  ]
};
    data: function(start, end, callback) {
      console.log(eventData1);
      callback(eventData1);
    }
users: usersWs, // user names array
showAsSeparateUsers: true,
displayOddEven: true,
displayFreeBusys: false,
displayEvents: true,
allowCalEventOverlap: true,
businessHours : {start: 7, end: 23, limitDisplay: true},
firstDayOfWeek : 1,
daysToShow: 6,
在日历中加载事件:

var eventData1 = {
    options: {
    timeslotsPerHour: 4,
    timeslotHeight: 20,
    showAsSeparateUsers: true
  },
  events : [
     {'id':1, 'start': new Date(year22, month22, day22, 12), 'end': new Date(year22, month22, day22, 13, 30),'title':'Lunch with Mike'},
     {'id':2, 'start': new Date(year22, month22, day22, 14), 'end': new Date(year22, month22, day22, 14, 45),'title':'Dev Meeting'},
     {'id':3, 'start': new Date(year22, month22, day22 + 1, 18), 'end': new Date(year22, month22, day22 + 1, 18, 45),'title':'Hair cut'},
     {'id':4, 'start': new Date(year22, month22, day22 - 1, 8), 'end': new Date(year22, month22, day22 - 1, 9, 30),'title':'Team breakfast'},
     {'id':5, 'start': new Date(year22, month22, day22 + 1, 14), 'end': new Date(year22, month22, day22 + 1, 15),'title':'Product showcase'}
  ]
};
    data: function(start, end, callback) {
      console.log(eventData1);
      callback(eventData1);
    }
users: usersWs, // user names array
showAsSeparateUsers: true,
displayOddEven: true,
displayFreeBusys: false,
displayEvents: true,
allowCalEventOverlap: true,
businessHours : {start: 7, end: 23, limitDisplay: true},
firstDayOfWeek : 1,
daysToShow: 6,
其他选项:

var eventData1 = {
    options: {
    timeslotsPerHour: 4,
    timeslotHeight: 20,
    showAsSeparateUsers: true
  },
  events : [
     {'id':1, 'start': new Date(year22, month22, day22, 12), 'end': new Date(year22, month22, day22, 13, 30),'title':'Lunch with Mike'},
     {'id':2, 'start': new Date(year22, month22, day22, 14), 'end': new Date(year22, month22, day22, 14, 45),'title':'Dev Meeting'},
     {'id':3, 'start': new Date(year22, month22, day22 + 1, 18), 'end': new Date(year22, month22, day22 + 1, 18, 45),'title':'Hair cut'},
     {'id':4, 'start': new Date(year22, month22, day22 - 1, 8), 'end': new Date(year22, month22, day22 - 1, 9, 30),'title':'Team breakfast'},
     {'id':5, 'start': new Date(year22, month22, day22 + 1, 14), 'end': new Date(year22, month22, day22 + 1, 15),'title':'Product showcase'}
  ]
};
    data: function(start, end, callback) {
      console.log(eventData1);
      callback(eventData1);
    }
users: usersWs, // user names array
showAsSeparateUsers: true,
displayOddEven: true,
displayFreeBusys: false,
displayEvents: true,
allowCalEventOverlap: true,
businessHours : {start: 7, end: 23, limitDisplay: true},
firstDayOfWeek : 1,
daysToShow: 6,
我可以了解更多细节。
谢谢大家的关注。

您应该通过向每个事件添加
userId:[id]
来将
事件分配给
用户,例如:

events : [
     {'id':1, 'start': ..., 'end': ...,'title':'Lunch with Mike', userId: [id]},
     {'id':2, 'start': ..., 'end': ...,'title':'Dev Meeting', userId: , userId: [id]},
     ...
]

那应该行得通看看

我刚试过。在官方文档中,当它创建事件时,只传递id、start、end和title参数。你可以在这里看到,他们也传递了用户ID哇!!我只是错过了这个例子,我会尝试一下,并在这里给出一个回报,等一下。。。