Add Events in edit mode with JSON

Issue #44 resolved
Lars Folmer-Petersen created an issue

Hi Lukasz,

I have tried several ways to get the Responsive Calendar accepting a result from a JSON result, but without luck, how should this be performed?

I have version 0.9 of Responsive Calendar, JQuery 1.11.3 The calendar works perfect, when I set the values hardcoded in the Javascript.

This working fine: $('.responsive-calendar').responsiveCalendar('edit', { "2015-09-10": {} });

This is not working:
var date = "2015-09-10"; $('.responsive-calendar').responsiveCalendar('edit', { date: {} });

Best regards Lars

Comments (5)

  1. Lukasz Kokoszkiewicz repo owner

    You cannot use variable as an object key. follow the examples from the webpage

  2. Lars Folmer-Petersen reporter

    Hi Lukasz,

    I have experienced this, but how can I then add events dynamicly to the calendar. I can't find any examples of this?

    Best Regards Lars

  3. Lukasz Kokoszkiewicz repo owner

    For example like this:

    var events = {
      "2013-04-30": {"number": 5, "badgeClass": "badge-warning", "url": "http://w3widgets.com/responsive-calendar"},
      "2013-04-26": {"number": 1, "badgeClass": "badge-warning", "url": "http://w3widgets.com"}, 
      "2013-05-03": {"number": 1, "badgeClass": "badge-error"}, 
      "2013-06-12": {}
    };
    
    $('#calendar').responsiveCalendar('edit', events);
    

    You have to format the input data as an object.

  4. Log in to comment