无法获取对象属性

时间:2014-02-14 05:14:52

标签: javascript jquery console.log

enter image description here

enter image description here

在控制台中作为完整对象检查时显示_id属性的对象的图像中 但是在console.log()

中单独检查时,它不会显示其_id属性
console.log(originalEventObject);
                                console.log(originalEventObject._id);

在控制台内看到的对象给出了图像中显示的值 但是当我检查对象id时,我在console.log()中得到了undefined 从对象中获取_id的正确方法是什么

(function($) {
    Drupal.fullcalendar.plugins.test_module = {
        options: function (fullcalendar, settings) {
            return {
                editable : true,
                droppable: true,
                dropAccept: '.ui-state-default',
                drop: function(date, allDay) {
                    if ($('#drop-remove').is(':checked')) {
                        $(this).draggable('disable');
                    }
                    alert("Dropped on " + date + " with allDay=" + allDay);
                    // retrieve the dropped element's stored Event Object                                                                     
                    var originalEventObject = $(this).data('eventObject');
                    originalEventObject.start = date;
                    originalEventObject.allDay = allDay;
                    originalEventObject.backgroundColor = 'red';
                    // render the event on the calendar                                                                                       
                    var obj = $('.fullcalendar').fullCalendar('clientEvents');
                    var val_id = [] ;
                    $.map(obj,function(val) {
                            val_id.push(val._id);
                        });
                    $.map(obj,function(val) {
                            if (originalEventObject.title == val.title) {
                                val.end = originalEventObject.start;
                                $.extend(val, originalEventObject);
                                var eid = val.eid;
                                var start = val.start;
                                var end;
                                if (val.end == null) {
                                end = val.start;
                                }
                        else {
                                var end = val.end;
                                }
 }
                                $.post('?q=test-alter-appointment-ajax', { start: start.toString(), end: end.toString(), eid: eid}, function(\
) { alert(3);});

                                console.log(originalEventObject);
                                console.log(originalEventObject._id);
                                $('.fullcalendar').fullCalendar('renderEvent', originalEventObject, true);
                                //$('.fullcalendar').fullCalendar('removeEvents',originalEventObject._id);                                    

                            }
                        });
                }
            };
        },
    };



}(jQuery));

0 个答案:

没有答案