Skip to content

Commit

Permalink
refetchResources refreshes the view
Browse files Browse the repository at this point in the history
When resources are refetched, all viewInstances are removed and current
one will be recreated. This way resources can be reloaded without need
to refresh the whole page.

Example:

$('#button_id_which_refreshes_resources').fullCalendar('refetchResources');
  • Loading branch information
Jarno Kurlin committed Sep 16, 2012
1 parent 0542538 commit dc5f6bf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,22 @@ function Calendar(element, options, eventSources, resourceSources) {

function refetchResources() {
fetchResources(false);

// we have to destroy all view instances and recreate current one
viewInstances = [];

// remove current view from display
currentView.element.remove();

// create current view again
currentView = viewInstances[currentView.name] = new fcViews[currentView.name](
newViewElement = absoluteViewElement =
$("<div class='fc-view fc-view-" + currentView.name + "' style='position:absolute'/>")
.appendTo(content),
t // the calendar object
);
// let's render the new view
renderView();
}

// called when event data arrives
Expand Down

0 comments on commit dc5f6bf

Please sign in to comment.