Fullcalendar手动添加startdate和enddate

时间:2012-05-24 12:23:46

标签: asp.net fullcalendar

这个forc的fullcalendar代码工作正常。 http://code.google.com/p/fullcalendar-asp-net/

如何手动输入或修改startdate和enddate? (还有日期时间选择器)
我尝试改变:

$('#addDialog').dialog({

    autoOpen: false,
    width: 470,
    buttons: {
        "Add": function () {

            //alert("sent:" + addStartDate.format("dd-MM-yyyy hh:mm:ss tt") + "==" + addStartDate.toLocaleString());
            var eventToAdd = {
                title: $("#addEventName").val(),
                description: $("#addEventDesc").val(),
                start: addStartDate.format("dd-MM-yyyy hh:mm:ss tt"),
                end: addEndDate.format("dd-MM-yyyy hh:mm:ss tt")

            };


$('#addDialog').dialog({

    autoOpen: false,
    width: 470,
    buttons: {
        "Add": function () {

            //alert("sent:" + addStartDate.format("dd-MM-yyyy hh:mm:ss tt") + "==" + addStartDate.toLocaleString());
            var eventToAdd = {
                title: $("#addEventName").val(),
                description: $("#addEventDesc").val(),
                start: $("#addEventStartDate").val(),
                end: $("#addEventEndDate").val(),
            };

function selectDate(start, end, allDay) {

$('#addDialog').dialog('open');

//$("#addEventStartDate").text("" + start.toLocaleString());
//$("#addEventEndDate").text("" + end.toLocaleString());

$("#addEventStartDate").val(start.format("dd/MM/yyyy hh:mm:ss tt"));
$("#addEventEndDate").val(end.format("dd/MM/yyyy hh:mm:ss tt"));

//addStartDate = start;
//addEndDate = end;
//globalAllDay = allDay;

//alert(allDay);

}

<div id="addDialog" style="font: 70% 'Trebuchet MS', sans-serif; margin: 50px;" title="Add Event">
<table cellpadding="0" class="style1">
        <tr>
            <td class="alignRight">
                name:</td>
            <td class="alignLeft">
                <input id="addEventName" type="text" size="50" /><br /></td>
        </tr>
        <tr>
            <td class="alignRight">
                description:</td>
            <td class="alignLeft">
                <textarea id="addEventDesc" cols="30" rows="3" ></textarea></td>
        </tr>
        <tr>
            <td class="alignRight">
                start:</td>
            <td class="alignLeft">
                <input id="addEventStartDate" onchange="start" type="text" size="50" /><br /></td>
        </tr>
        <tr>
            <td class="alignRight">
                end:</td>
            <td class="alignLeft">
                <input id="addEventEndDate" type="text" size="50" /><br /></td>
        </tr>
    </table>

</div>

非常感谢

1 个答案:

答案 0 :(得分:0)

您是否尝试将对话框绑定到FullCalendar的dayClick回调?此外,您可以在对话框中使用任何datePicker(如jQuery UI DatePicker)。

您可以使用eventClick回调编辑日历上已创建的事件。

希望这有帮助!