My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 832: How to update custom option in Loading
2 people starred this issue and may be notified of changes. Back to list
Status:  Duplicate
Merged:  issue 293
Owner:  ----
Closed:  Feb 2011


Sign in to add a comment
 
Reported by p0020...@brookes.ac.uk, Feb 15, 2011
I am trying to add a payload option to the calendar, that is when loading the list of event sources, I want to be able to get some data to pass over to it. 

in the _fetchEventSource I am adding:

params['payload'] =   options.payload;  //{ test: 1 };

to send data up. The test:1 part will work, and it is received.

If I set the payload on the initialisation then it comes through. However, If I try and update the 'option' 'payload' via:

$("#calendar").fullCalendar('option', 'payload', { test: 1, check: true });

nothing seems to come through. Is this the right approach? have I missed something obvious out?

Thanks
Feb 15, 2011
#1 p0020...@brookes.ac.uk
I should also add, that I am updating it in the Loading event, and i can tell from some JS Alerts, that it is happening in the correct order. Here is the code for the updated _fetchEventSource

            if (typeof source == 'string') {
                var params = {};
                params[options.startParam] = Math.round(rangeStart.getTime() / 1000);
                params[options.endParam] = Math.round(rangeEnd.getTime() / 1000);

                pushLoading();


                if (options.cacheParam) {
                    params[options.cacheParam] = (new Date()).getTime(); // TODO: deprecate cacheParam
                }
                alert('Set Param');
                params['payload'] =   options.payload; //{ test: 1 };

                // TODO: respect cache param in ajaxSetup
                $.ajax({
                    type: options.ajaxType || 'GET',
                    url: source,
                    dataType: 'json',
                    data: jQuery.toJSON(params), //params,
                    contentType: "application/json; charset=utf-8",
                    cache: options.cacheParam || false, // don't let jquery prevent caching if cacheParam is being used
                    success: function(events) {
                        popLoading();
                        var decodedResult = events.d;
                        callback(decodedResult);
                    }
                });
            }

and for loading:

    function calendarLoad(isLoading, view) {
        if (isLoading) {
            alert("set payload");
            $("#calendar").fullCalendar('option', 'payload', { test: 1, check: true });
        }
    }
Feb 15, 2011
Project Member #2 althaus.it
IIRC fullcalendar doesn't support updating options at all.
Feb 15, 2011
#3 p0020...@brookes.ac.uk
but the documentation says 

$('#calendar').fullCalendar('option', 'height', 700);

is valid for updating the height?

Not every property has a "setter" though, so not sure how any of it works :-/ Is there a better way?
Feb 15, 2011
Project Member #4 adamrs...@gmail.com
right now, the height-related options are the only ones that can be set dynamically. after  issue 293  is complete, EVERY option will be able to be set dynamically. merging...
Status: Duplicate
Mergedinto: 293
Feb 15, 2011
#5 p0020...@brookes.ac.uk
What about an ability to send more data to the server, will this also be merged, or is there an outstanding request for this somewhere I didn't find in my searching?
Feb 15, 2011
Project Member #6 adamrs...@gmail.com
sending data in the json request will be made much easier when this is completed:
https://code.google.com/p/fullcalendar/issues/detail?id=386

(which will be very soon. in 1.5)
Feb 15, 2011
#7 p0020...@brookes.ac.uk
Is there an approx release date you have in mind? Trying to balance continuing with a work around compared to waiting on a permanent fix. Thanks for swift reply :)
Feb 15, 2011
Project Member #8 adamrs...@gmail.com
not completely sure, but in next 2 weeks. you can download the latest from github and start using right away if you want. that part is already implemented (see the tests/sources_new.html for examples).
Feb 27, 2011
#9 p0020...@brookes.ac.uk
Hey, I was just wondering how v1.5 was going. I see there is a new 1.4.11, but assume that this does not have the additional parameters part implemented as it is just a bug fix?

Do you have a script you run to generate the latest code from GitHub? I saw there were many files there and not sure on the correct order, or dependancies required?

Thanks
Sign in to add a comment

Powered by Google Project Hosting