Unable to refill events after ClearAll or clear

Create issue
Issue #48 new
Former user created an issue

I am trying to clear the events and then again populate new events. But when I clear the events, it just doesn't add any new events rather it clears all the data. I need to refresh the calander after every

 $('.responsive-calendar').responsiveCalendar('clearAll');
        $(".responsive-calendar").responsiveCalendar({                    
            allRows: false,
            events: events               
        });

Comments (4)

  1. Lukasz Kokoszkiewicz repo owner

    Hi, you are clearing the events correctly but adding new in a wrong way. You should refer to the documentation: http://w3widgets.com/responsive-calendar/#methods

    And do it like this:

    $('#calendar').responsiveCalendar('edit', {
        "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": {}
    });
    

    Or in your case:

    $('#calendar').responsiveCalendar('edit', events);
    
  2. Amir Shaheen

    its not working

    $('#calendar').responsiveCalendar('edit', events);

    but when using like

    $('#calendar').responsiveCalendar('edit', { "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": {} });

    then its working.

  3. Amir Shaheen

    resolved.

    its my mistake that i am not mentioning dataType in my ajax call, just added that line and its resolved.

    Thanks

  4. Meher Krishnakanth Tennety

    Hi actually I need to refill but also I want to implement "onInit:function() and onMonthChange:function()".How can I do it ?

    something Like :

    $(".responsive-calendar").responsiveCalendar('clearAll');
                  $(".responsive-calendar").responsiveCalendar('2015-02');
                  $(".responsive-calendar").responsiveCalendar('edit',{
                          "2015-02-01": {"number": 5, "url": "http://w3widgets.com/responsive-slider"},
                          "2015-02-27": {"number": 1, "url": "http://w3widgets.com"}, 
                          "2015-03-04":{"number": 1}, 
                          "2015-04-13": {},
                          "2016-01-13": {},
                      },
    onInit:function(){}/ I need it here
    onMonthChange:function(){) // I need it here
                   );
    

    or any other way to destroy and remap ?

  5. Log in to comment