[FullCalendar 2] EventsRESTUrl formData

[FullCalendar 2] EventsRESTUrl formData

  
Forge Component
(8)
Published on 23 Mar by Grazina
8 votes
Published on 23 Mar by Grazina
Hi again, is there a way to customize what is passed to the formData input parameter on the EventsRESTUrl. I need an additional value to come over to my REST service since my application is multi tenant and I need to pass the tenant id so I can switch to that tenant in my REST api so my aggregates query the correct data.
Hi Cody,

I've only just seen this question here.
The EventsRESTUrl attribute is pretty standard, and only supports start and end parameters. You heve several other options available. I think what you're looking for can be achieved by using the solution described here.

Dynamic data parameter

The data parameters, which sends information to your JSON script through either GET or POST, can also be specified as a function, in order to send dynamic values:

$('#calendar').fullCalendar({

    events: {
        url: '/myfeed.php',
        data: function() { // a function that returns an object
            return {
                dynamic_value: Math.random()
            };
        }
    }

});

The startParam and endParam values will still automatically be included.


This means you can include additional parameters on your feed. To use it, you have the EventsJSON attribute wich should receive an Event description object. Like this:
"{
    url: '/myfeed.php',
    data: function() { // a function that returns an object
        return {
            dynamic_value: Math.random()
        };
    }
}"
There are simpler options described in the same page.

Kind Regards,
João Grazina
Very very cool, thanks again this is fantastic.