0
votes

what I'm possibly doing wrong!?

I do NOT see my events when 'defaultView: agendaWeek' (or agendaDay). PS: basicWeek (or basicDay) works just fine.

BUT: when clicking the 'month' view: ALL events are showing correctly in 'month' view! Then, when again clicking 'week' (or Day) I see them ALL correctly as agendaWeek (or agendaDay) view!

I'm running fullcalendar: 3.6.2

PS: sorry, posted same issue in non-related forum

must miss a stupid thing - thanks for your time and hints, ed

 <script type="text/javascript">
        (function ($) {
@if (Model.tagColorsEnabled && Model.tagColors != null) {
    <text>
            var tagSet = [
                @foreach (var tc in Model.tagColors)
                {
                    @Display(tc)
                }
            ];

            var tagIndex = [];
            for (var tag in tagSet) {
                tagIndex[tagSet[tag].slug] = tag;
            }

    </text>
}
            $('#calendar').fullCalendar({
                locale: '@culture',
                timeFormat: 'HH:mm',   //eddie  timeFormat: 'HH:mm{-HH:mm}', 
                slotLabelFormat: 'HH:mm',   //eddie  timeFormat: 'HH:mm{-HH:mm}', 
                // height: 500, //added by eddie
                // allDay: false,   // eddie
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month, agendaWeek, agendaDay',
                    //  right: 'month, agendaWeek, agendaDay'  // eddie
                },
                    
                eventRender: function (event, element) {
                    var colors = { bg : event.defaultBackgroundColor, br: event.defaultBorderColor, fg: event.defaultTextColor };
@if (Model.tagColorsEnabled)
{
    <text>
                    var min = 100;
                    for (var klassNdx in event.className) {
                        var klass = event.className[klassNdx];
                        if (klass.substring(0, 4) === "tag-") {
                            var entry = tagIndex[klass.substring(4)];
                            if (entry !== undefined) {
                                if (entry < min) {
                                    colors = tagSet[entry];
                                    min = entry;
                                }
                            }
                        }
                    }
    </text>
}
                    $(element)
                        .css("background-color", colors.bg)
                        .css("color", colors.fg)
                        .css("border-color", colors.br);
                },
               
                editable: false,
                events: { 
                    url: '@Url.Content("~/_Calendar/" + Model.queryId)',
                },
               // defaultView: '@Model.defaultView',
                // defaultView: 'basicWeek',
                defaultView: 'agendaWeek',
                weekends: @Model.showWeekends
                //viewRender: function (v, e) { alert("Rendering view"); }
                });
        })(jQuery);
    </script>
1
without some sample event data it might be quite difficult to reproduce this. Can you show some sample event JSON data which can be used to demo the problem? I can't think of a reason, in normal use, why you would have a problem like this. - ADyson
Thanks for your time. I certainly agree with your judgement - this code runs in OrchardCMS and I wouldn't know how to e.g. us 'fiddle' to check. Well the amazing thing is that my 'eventRender: function (event ...' is showing ALL my events BUT only after I 'click' the 'month' -> 'weeks' view (never uses the 'defaultView: 'agendaWeek' directly )'. Clearly I need to investigate more ... I was kind of hoping that somebody experienced similar issues before ... - edik
an addition: when defaultView: 'basicWeek' - I see all my events correctly in 'basicView' - clicking then 'Week' gives me the 'agendaView' - edik
I wasn't asking for a JSfiddle necessarily, just some sample event JSON data (you can get it by watching your network tab for the ajax request which fetches them. - ADyson
used the weekend to learn about JSON, Network, XHR ... and found when 'defaultView: basicWeek' {id: 16, start: "2017-11-09T08:00:00", end: "2017-11-09T09:00:00", allDay: false, title: "Sevent 1",…} when 'defaultView: agendaWeek' ExceptionMessage:"String was not recognized as a valid DateTime." I certainly do not change anyof the time formats in between! Need to do some more tests thanks again for your advise, ed - edik

1 Answers

0
votes

solved - sort of!

When using 'defaultView: basicWeek / agendaWeek'; fact is that I get different DateTime info like:

basicWeek: '2017-1-06' --> which in turn works correctly!

agendaWeek: '2017-1-06T00:00:00' --> which results in an error!

When stripping off 'T00:.....' --> problem solved I know that this is probably not the 'clean' solution BUT for the time being ..... will further check if time is available! For now I like to thank ADyson for his advise and time spent.