DayPilot 日历创建事件
DayPilot Calendar create event
我正在尝试实施 Daypilot lite 日历。到目前为止一切顺利,但我似乎遇到了一些问题。
我正在尝试在日历中创建一个新事件,但我似乎无法将事件的开始和结束以外的任何信息传递给 daypilot 模式。
JavaScript runtime error: 'team' is undefined
上面一行是我遇到的错误。
我的aspx页面中的控制代码:
<h1>Welcome <asp:Label ID="lblTeam" runat="server"></asp:Label></h1>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="0">Select a pitch</asp:ListItem>
</asp:DropDownList>
<DayPilot:DayPilotCalendar
ID="DayPilotCalendar1"
runat="server"
DataStartField="sess_start"
ShowEventStartEnd="true"
DataEndField="sess_end"
DataTextField="team"
DataIdField="BookingId"
ClientObjectName="dpc1"
TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="timeRangeSelected(start, end, team, pitch)"
OnCommand="DayPilotCalendar1_Command"
NonBusinessBackColor="Black"
HeightSpec="BusinessHoursNoScroll"
BusinessEndsHour="20"
OnEventMove="DayPilotCalendar1_EventMove"
EventMoveHandling="CallBack"
/>
我的 JavaScript 发送数据到模式的代码:
function timeRangeSelected(start, end, team, pitch) {
team = document.getElementById('<%= lblTeam.ClientID %>').innerText;
var pitchSel = document.getElementById('<%= DropDownList1.ClientID %>');
pitch = pitchSel.options[pitchSel.selectedIndex].value;
var modal = new DayPilot.Modal();
modal.top = 60;
modal.width = 300;
modal.opacity = 70;
modal.border = "10px solid #d0d0d0";
modal.closed = function () {
if (this.result == "OK") {
dpc1.commandCallBack('refresh');
}
dpc1.clearSelection();
};
modal.showUrl("New.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&r=" + team + "&pitch=" + pitch);
}
我需要能够将不仅仅是开始和结束传递给模态。
正如我所提到的,我不太确定这里发生了什么,所以如果能提供任何指导,我们将不胜感激。
我发现我做错了什么所以我想我会与 SO 分享它以防其他人遇到同样的麻烦。
下面是我更新的 JavaScript 代码。基本上我的问题与我声明用于存储数据以传递给模态的变量的位置有关。当需要在函数范围之外声明它们时,我将它们放在函数内部。愚蠢的错误,但很容易犯。
var team = document.getElementById('<%= lblTeam.ClientID %>').innerText;
var pitchSel = document.getElementById('<%= DropDownList1.ClientID %>');
var pitch = pitchSel.options[pitchSel.selectedIndex].value;
function timeRangeSelected(start, end, team, pitch) {
var modal = new DayPilot.Modal();
modal.top = 60;
modal.width = 300;
modal.opacity = 70;
modal.border = "10px solid #d0d0d0";
modal.closed = function () {
if (this.result == "OK") {
dpc1.commandCallBack('refresh');
}
dpc1.clearSelection();
};
modal.showUrl("New.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&r=" + team + "&pitch=" + pitch);
}
我希望这对以后的人有所帮助。甚至可能是我,你永远不知道!
我正在尝试实施 Daypilot lite 日历。到目前为止一切顺利,但我似乎遇到了一些问题。
我正在尝试在日历中创建一个新事件,但我似乎无法将事件的开始和结束以外的任何信息传递给 daypilot 模式。
JavaScript runtime error: 'team' is undefined
上面一行是我遇到的错误。 我的aspx页面中的控制代码:
<h1>Welcome <asp:Label ID="lblTeam" runat="server"></asp:Label></h1>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="0">Select a pitch</asp:ListItem>
</asp:DropDownList>
<DayPilot:DayPilotCalendar
ID="DayPilotCalendar1"
runat="server"
DataStartField="sess_start"
ShowEventStartEnd="true"
DataEndField="sess_end"
DataTextField="team"
DataIdField="BookingId"
ClientObjectName="dpc1"
TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="timeRangeSelected(start, end, team, pitch)"
OnCommand="DayPilotCalendar1_Command"
NonBusinessBackColor="Black"
HeightSpec="BusinessHoursNoScroll"
BusinessEndsHour="20"
OnEventMove="DayPilotCalendar1_EventMove"
EventMoveHandling="CallBack"
/>
我的 JavaScript 发送数据到模式的代码:
function timeRangeSelected(start, end, team, pitch) {
team = document.getElementById('<%= lblTeam.ClientID %>').innerText;
var pitchSel = document.getElementById('<%= DropDownList1.ClientID %>');
pitch = pitchSel.options[pitchSel.selectedIndex].value;
var modal = new DayPilot.Modal();
modal.top = 60;
modal.width = 300;
modal.opacity = 70;
modal.border = "10px solid #d0d0d0";
modal.closed = function () {
if (this.result == "OK") {
dpc1.commandCallBack('refresh');
}
dpc1.clearSelection();
};
modal.showUrl("New.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&r=" + team + "&pitch=" + pitch);
}
我需要能够将不仅仅是开始和结束传递给模态。 正如我所提到的,我不太确定这里发生了什么,所以如果能提供任何指导,我们将不胜感激。
我发现我做错了什么所以我想我会与 SO 分享它以防其他人遇到同样的麻烦。
下面是我更新的 JavaScript 代码。基本上我的问题与我声明用于存储数据以传递给模态的变量的位置有关。当需要在函数范围之外声明它们时,我将它们放在函数内部。愚蠢的错误,但很容易犯。
var team = document.getElementById('<%= lblTeam.ClientID %>').innerText;
var pitchSel = document.getElementById('<%= DropDownList1.ClientID %>');
var pitch = pitchSel.options[pitchSel.selectedIndex].value;
function timeRangeSelected(start, end, team, pitch) {
var modal = new DayPilot.Modal();
modal.top = 60;
modal.width = 300;
modal.opacity = 70;
modal.border = "10px solid #d0d0d0";
modal.closed = function () {
if (this.result == "OK") {
dpc1.commandCallBack('refresh');
}
dpc1.clearSelection();
};
modal.showUrl("New.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&r=" + team + "&pitch=" + pitch);
}
我希望这对以后的人有所帮助。甚至可能是我,你永远不知道!