mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-09-11 12:10:23 +08:00
Adds resourceFilter option
This commit is contained in:
@@ -48,12 +48,10 @@ function ResourceManager(options) {
|
||||
*/
|
||||
|
||||
function fetchResources(useCache, currentView) {
|
||||
var cache;
|
||||
// if useCache is not defined, default to true
|
||||
useCache = (typeof useCache !== 'undefined' ? useCache : true);
|
||||
if (cache !== undefined && useCache) {
|
||||
// get from cache
|
||||
return cache;
|
||||
} else {
|
||||
if (!useCache || cache === undefined) {
|
||||
// do a fetch resource from source, rebuild cache
|
||||
cache = [];
|
||||
var len = resourceSources.length;
|
||||
@@ -61,8 +59,13 @@ function ResourceManager(options) {
|
||||
var resources = fetchResourceSource(resourceSources[i], currentView);
|
||||
cache = cache.concat(resources);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
if($.isFunction(options.resourceFilter)) {
|
||||
return $.grep(cache, options.resourceFilter);
|
||||
}
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,4 +134,4 @@ function ResourceManager(options) {
|
||||
normalizers[i](source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user