Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddResourceSource/RemoveResourceSource ? Dynamic resources changes #11

Open
Haks1 opened this issue Mar 19, 2014 · 1 comment
Open

AddResourceSource/RemoveResourceSource ? Dynamic resources changes #11

Haks1 opened this issue Mar 19, 2014 · 1 comment

Comments

@Haks1
Copy link

Haks1 commented Mar 19, 2014

Hi !

I wordered how can I change the "resourceSource" using "resources" option, based on JSON that I get from socket.io (I change the calendar with a dropdown list).

I've seen that we can do it with events (http://stackoverflow.com/questions/10940182/change-fullcalendar-event-source-after-load#answer-10941552) but I don't retrieve this functions for resources.

Have you a good way to do it with the resource view or do I need to make a custom mod ?

@Haks1
Copy link
Author

Haks1 commented Mar 19, 2014

For now, I've modify the source, I will try a better way in the future:

    /**
     * ----------------------------------------------------------------
     * Fetch resources from source array
     * ----------------------------------------------------------------
     */
    function fetchResources(useCache, currentView) {
        // if useCache is not defined, default to true
        useCache = typeof useCache !== 'undefined' ? useCache : true;

        if (cache != undefined && useCache) {
            // get from cache
            return cache;
        } else {
            // do a fetch resource from source, rebuild cache
            cache = [];

            /** TWEAK BY HAKS **/

            var resources = _fetchResourceSource({url: "/projetcollaborateur/findProjCollabs?proj=" + $("#selectCalProj option:selected").val()}, currentView);
            cache = cache.concat(resources);
            /*
            var len = sources.length;
            for (var i = 0; i < len; i++) {
                var resources = _fetchResourceSource(sources[i], currentView);
                cache = cache.concat(resources);
            }*/
            /** END TWEAK **/

            return cache;
        }
    }

@Haks1 Haks1 closed this as completed Mar 19, 2014
@Haks1 Haks1 reopened this Mar 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant