dsjlqkbpn029473708 2015-02-28 07:04
浏览 122

如何在fullcalendar jquery插件中获取allDay的值?

I'm using the fullcalendar jquery plugin and I want to get the value of allDay that is true or false and I want to append the value to a form.But value that is getting appended is [object Object]

<input type="hidden" id="apptAllDay" value="[object Object]">


<script type="text/javascript">
$(document).ready(function(){

    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        defaultDate: '2015-02-12',
        selectable: true,
        selectHelper: true,
        select: function(start, end, allDay) {

            $('#apptStartTime').val(start);
            $('#apptEndTime').val(end);          
            $('#apptAllDay').val(allDay);


            $.magnificPopup.open({
                  items: {
                    src: '#popup',
                    type: 'inline'
                  }
            });


        },
        editable: true,
        eventLimit: true, // allow "more" link when too many events
        eventStartEditable : false,
        events: "http://localhost/app1/events",
    });



    $(document).on("click","#addEvent",function(e) {
        e.preventDefault();
        doSubmit();
    });


    function doSubmit(){

        var title = $("#titleContainer").val();
        var description = $.trim($("#descContainer").val());
        var url = $("#urlContainer").val();

        if (!title) {
            alert("Title is required");
            return false;
        }

        $("#calendar").fullCalendar('renderEvent',
            {
                title: title,
                start: new Date($('#apptStartTime').val()),
                end: new Date($('#apptEndTime').val()),
                allDay: ($('#apptAllDay').val() == "true")
            },
        true);

       }

});

How can I get the real value that is TRUE or FAlSE?

  • 写回答

1条回答 默认 最新

  • duankange2433 2015-03-02 10:58
    关注

    This might probably help you, change according to your requirement.

    function parseClientEvents(){
        var clientArr = $('#calendar').fullCalendar('clientEvents');
        for(i in clientArr){
             console.log(clientArr[i]);//gives events full description.
             console.log(clientArr[i].allDay);
            //check for value here and append to your hidden field.
           //all your logic goes here.         
        }
        return true;
    }

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog