-1

I am using fullcalendar 4.0, and trying to get event source record with both the methods and 10411 is the "id" filed valuse in event as:

{id : 10411,title : 'sample',start : 'date'}

var eventdetails = calendar.getEventSourceById('10411');
var eventdetails = calendar.getEventSourceById('clientEvents','10411');

Please share any ideas.

ADyson
  • 57,178
  • 14
  • 51
  • 63
Prabha
  • 266
  • 4
  • 25

1 Answers1

1

What you appear to have there is a single event, not an event source. (An event source, as the name suggests, defines a source of events, i.e. a place to fetch events from, not an individual event.)

There are different methods for fetching individual events - see https://fullcalendar.io/docs/Calendar-getEventById and https://fullcalendar.io/docs/Calendar-getEvents

So in your case you would write

var eventdetails =  calendar.getEventById(10411);
ADyson
  • 57,178
  • 14
  • 51
  • 63
  • Thank you @ADyson, for more details please check the link https://fullcalendar.io/docs/upgrading-from-v3, We can not get event with any other field except ID,once we get all events with getEVents method, to filter the events use var someEvents = calendar.getEvents().filter(function(event) { return event.title === 'My Event'; }); – Prabha Jun 09 '20 at 07:25
  • In v4 you can just get all the events with the `calendar.getEvents()` method, and then filter them yourself - filtering an array with JavaScript is quite easy, you will find lots of examples online. – ADyson Jun 09 '20 at 07:52