How to Customize Data FullcalendarBundle from a SUBMIT formfullcalendar show event based on checkbox valueSymfony 3 FullCalendarBundle data loadHow do JavaScript closures work?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How to check whether a checkbox is checked in jQuery?How do I include a JavaScript file in another JavaScript file?Convert form data to JavaScript object with jQueryHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?
is it permitted to swallow spit on a fast day?
Why are low spin tetrahedral complexes so rare?
Why should password hash verification be time consistent?
How to handle DM constantly stealing everything from sleeping characters?
Does the 500 feet falling cap apply per fall, or per turn?
How to get a ellipse shaped node in Tikz Network?
What's the difference between const array and static const array in C/C++
How to make a language evolve quickly?
How to rename pi as another value only for y axis without affecting pi used in x axis?
Why does increasing the sampling rate make implementing an anti-aliasing filter easier?
Cryptography and elliptic curves
How to get the IP of a user who executed a command?
Is every story set in the future "science fiction"?
How can a demonic viral infection spread throughout the body without being noticed?
What is wrong with my code? RGB potentiometer
Is there a need for better software for writers?
What food production methods would allow a metropolis like New York to become self sufficient
Different problems with tabularx
Why can't I prove summation identities without guessing?
What can cause an unfrozen indoor copper drain pipe to crack?
Passport stamps art, can it be done?
Would encrypting a database protect against a compromised admin account?
Is it nonsense to say B > [A > B]?
Is it bad writing or bad story telling if first person narrative contains more information than the narrator knows?
How to Customize Data FullcalendarBundle from a SUBMIT form
fullcalendar show event based on checkbox valueSymfony 3 FullCalendarBundle data loadHow do JavaScript closures work?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How to check whether a checkbox is checked in jQuery?How do I include a JavaScript file in another JavaScript file?Convert form data to JavaScript object with jQueryHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
i have added a select form above the FullCalendar to select an user and show his events
the question is how to load the events of the user selected in the calendar
THIS is some of code:
In Calender.html.twig
% block javascripts %
parent()
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
]
);
);
</script>
UPDATE 1 :
I have have changed the code to :
% extends 'base.html.twig' %
% block body %
<div class="container">
<select id="school_selector">
<option value="User1">User1</option>
<option value="User2">User2</option>
<option value="User3">User3</option>
</select>
<div class="p-3 mb-2 bg-primary text-white">Calendrier des entretiens</div>
<div class="bg-light">
<a href=" path('booking_new') ">Create new booking</a>
% include '@FullCalendar/Calendar/calendar.html.twig' %
</div>
</div>
% endblock %
% block stylesheets %
parent()
<link rel="stylesheet" href=" asset('bundles/fullcalendar/css/fullcalendar/fullcalendar.min.css') " />
% endblock %
% block javascripts %
parent()
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/locale-all.js') "></script>
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
eventRender: function eventRender( event, element, view )
return ['', event.USER].indexOf($('#school_selector').val()) >= 0
);
$('#school_selector').on('change',function()
$('#calendar-holder').fullCalendar('rerenderEvents');
)
);
</script>
% endblock %
AppEnityEvent
<?php
namespace AppEntity;
class Event extends ToibaFullCalendarBundleEntityEvent
/**
* @var string
*/
protected $User;
/**
* @param string $User
*/
public function __construct($title, DateTime $start, DateTime $end = null,$User)
parent::__construct($title,$start,$end);
$this->User=$User;
/**
* @return string
*/
public function getUser()
return $this->User;
/**
* @param string $User
*/
public function setUser($User)
$this->User = $User;
AppEventListenerFullCalendarListener ( loadEvents )
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('b')
->andWhere('b.beginAt BETWEEN :startDate and :endDate')
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
I HAVE TRIED this one, but nothing is display :(
Ps: The entity Event have id, begin_at, title, end_at, user
// User= Name of user
Sample event data:
[
title: 'Event1', start: '2019-03-01', end: '2019-03-02', User: 'User1', ,
title: 'Event2', start: '2019-03-04', end: '2019-03-05', User: 'User2', ,
]
javascript jquery twig fullcalendar
|
show 13 more comments
i have added a select form above the FullCalendar to select an user and show his events
the question is how to load the events of the user selected in the calendar
THIS is some of code:
In Calender.html.twig
% block javascripts %
parent()
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
]
);
);
</script>
UPDATE 1 :
I have have changed the code to :
% extends 'base.html.twig' %
% block body %
<div class="container">
<select id="school_selector">
<option value="User1">User1</option>
<option value="User2">User2</option>
<option value="User3">User3</option>
</select>
<div class="p-3 mb-2 bg-primary text-white">Calendrier des entretiens</div>
<div class="bg-light">
<a href=" path('booking_new') ">Create new booking</a>
% include '@FullCalendar/Calendar/calendar.html.twig' %
</div>
</div>
% endblock %
% block stylesheets %
parent()
<link rel="stylesheet" href=" asset('bundles/fullcalendar/css/fullcalendar/fullcalendar.min.css') " />
% endblock %
% block javascripts %
parent()
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/locale-all.js') "></script>
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
eventRender: function eventRender( event, element, view )
return ['', event.USER].indexOf($('#school_selector').val()) >= 0
);
$('#school_selector').on('change',function()
$('#calendar-holder').fullCalendar('rerenderEvents');
)
);
</script>
% endblock %
AppEnityEvent
<?php
namespace AppEntity;
class Event extends ToibaFullCalendarBundleEntityEvent
/**
* @var string
*/
protected $User;
/**
* @param string $User
*/
public function __construct($title, DateTime $start, DateTime $end = null,$User)
parent::__construct($title,$start,$end);
$this->User=$User;
/**
* @return string
*/
public function getUser()
return $this->User;
/**
* @param string $User
*/
public function setUser($User)
$this->User = $User;
AppEventListenerFullCalendarListener ( loadEvents )
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('b')
->andWhere('b.beginAt BETWEEN :startDate and :endDate')
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
I HAVE TRIED this one, but nothing is display :(
Ps: The entity Event have id, begin_at, title, end_at, user
// User= Name of user
Sample event data:
[
title: 'Event1', start: '2019-03-01', end: '2019-03-02', User: 'User1', ,
title: 'Event2', start: '2019-03-04', end: '2019-03-05', User: 'User2', ,
]
javascript jquery twig fullcalendar
Implement your event source using this pattern: fullcalendar.io/docs/events-function . Then your function can get the currently selected user ID from the select box and send the value to the server as part of the ajax request. The server will then filter the returned data according to the user ID. The other part of this is that you need to handle the "change" event of the select box using JavaScript, and in that event handler you just run the "refetchEvents" method of fullCalendar to make it reload the data using the new value. Give that idea a try and post code if you get stuck.
– ADyson
Mar 1 at 9:59
For example, i'm admin and i want select an user by his name and show all his event in calendar
– Khalil
Mar 1 at 10:00
1
I am looking already. So two things: 1) it seems your Event class's "User" property is protected. So I'm not convinced this will get serialised to JSON - you may need to make it public instead of protected. 2) JS property names are case-sensitive. So even if "User" is serialised,event.USER
will not match it.event.User
should match it, if it's there. This is why I asked you to provide a sample of your JSON event data as returned by the server. Can you now do that please? Then I know exactly what data your JavaScript is trying to interact with.
– ADyson
Mar 1 at 14:25
1
Actually, I can prove the User property won't be serialised. Demo: sandbox.onlinephpfunctions.com/code/… . Whereas if you make it public, it will. Demo: sandbox.onlinephpfunctions.com/code/…
– ADyson
Mar 1 at 14:31
1
Ok so changeevent.USER
toevent.User
in your eventRender code and try again
– ADyson
Mar 1 at 14:36
|
show 13 more comments
i have added a select form above the FullCalendar to select an user and show his events
the question is how to load the events of the user selected in the calendar
THIS is some of code:
In Calender.html.twig
% block javascripts %
parent()
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
]
);
);
</script>
UPDATE 1 :
I have have changed the code to :
% extends 'base.html.twig' %
% block body %
<div class="container">
<select id="school_selector">
<option value="User1">User1</option>
<option value="User2">User2</option>
<option value="User3">User3</option>
</select>
<div class="p-3 mb-2 bg-primary text-white">Calendrier des entretiens</div>
<div class="bg-light">
<a href=" path('booking_new') ">Create new booking</a>
% include '@FullCalendar/Calendar/calendar.html.twig' %
</div>
</div>
% endblock %
% block stylesheets %
parent()
<link rel="stylesheet" href=" asset('bundles/fullcalendar/css/fullcalendar/fullcalendar.min.css') " />
% endblock %
% block javascripts %
parent()
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/locale-all.js') "></script>
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
eventRender: function eventRender( event, element, view )
return ['', event.USER].indexOf($('#school_selector').val()) >= 0
);
$('#school_selector').on('change',function()
$('#calendar-holder').fullCalendar('rerenderEvents');
)
);
</script>
% endblock %
AppEnityEvent
<?php
namespace AppEntity;
class Event extends ToibaFullCalendarBundleEntityEvent
/**
* @var string
*/
protected $User;
/**
* @param string $User
*/
public function __construct($title, DateTime $start, DateTime $end = null,$User)
parent::__construct($title,$start,$end);
$this->User=$User;
/**
* @return string
*/
public function getUser()
return $this->User;
/**
* @param string $User
*/
public function setUser($User)
$this->User = $User;
AppEventListenerFullCalendarListener ( loadEvents )
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('b')
->andWhere('b.beginAt BETWEEN :startDate and :endDate')
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
I HAVE TRIED this one, but nothing is display :(
Ps: The entity Event have id, begin_at, title, end_at, user
// User= Name of user
Sample event data:
[
title: 'Event1', start: '2019-03-01', end: '2019-03-02', User: 'User1', ,
title: 'Event2', start: '2019-03-04', end: '2019-03-05', User: 'User2', ,
]
javascript jquery twig fullcalendar
i have added a select form above the FullCalendar to select an user and show his events
the question is how to load the events of the user selected in the calendar
THIS is some of code:
In Calender.html.twig
% block javascripts %
parent()
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
]
);
);
</script>
UPDATE 1 :
I have have changed the code to :
% extends 'base.html.twig' %
% block body %
<div class="container">
<select id="school_selector">
<option value="User1">User1</option>
<option value="User2">User2</option>
<option value="User3">User3</option>
</select>
<div class="p-3 mb-2 bg-primary text-white">Calendrier des entretiens</div>
<div class="bg-light">
<a href=" path('booking_new') ">Create new booking</a>
% include '@FullCalendar/Calendar/calendar.html.twig' %
</div>
</div>
% endblock %
% block stylesheets %
parent()
<link rel="stylesheet" href=" asset('bundles/fullcalendar/css/fullcalendar/fullcalendar.min.css') " />
% endblock %
% block javascripts %
parent()
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/jquery.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/lib/moment.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/fullcalendar.min.js') "></script>
<script type="text/javascript" src=" asset('bundles/fullcalendar/js/fullcalendar/locale-all.js') "></script>
<script type="text/javascript">
$(function ()
$('#calendar-holder').fullCalendar(
height: 'parent',
themeSystem: 'bootstrap4',
locale: 'fr',
header:
left: 'prev, next, today',
center: 'title',
right: 'month, agendaWeek, agendaDay'
,
businessHours:
start: '09:00',
end: '18:00',
dow: [1, 2, 3, 4, 5]
,
height: "auto",
contentHeight: "auto",
lazyFetching: true,
navLinks: true,
selectable: true,
editable: true,
eventDurationEditable: true,
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
eventRender: function eventRender( event, element, view )
return ['', event.USER].indexOf($('#school_selector').val()) >= 0
);
$('#school_selector').on('change',function()
$('#calendar-holder').fullCalendar('rerenderEvents');
)
);
</script>
% endblock %
AppEnityEvent
<?php
namespace AppEntity;
class Event extends ToibaFullCalendarBundleEntityEvent
/**
* @var string
*/
protected $User;
/**
* @param string $User
*/
public function __construct($title, DateTime $start, DateTime $end = null,$User)
parent::__construct($title,$start,$end);
$this->User=$User;
/**
* @return string
*/
public function getUser()
return $this->User;
/**
* @param string $User
*/
public function setUser($User)
$this->User = $User;
AppEventListenerFullCalendarListener ( loadEvents )
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('b')
->andWhere('b.beginAt BETWEEN :startDate and :endDate')
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
I HAVE TRIED this one, but nothing is display :(
Ps: The entity Event have id, begin_at, title, end_at, user
// User= Name of user
Sample event data:
[
title: 'Event1', start: '2019-03-01', end: '2019-03-02', User: 'User1', ,
title: 'Event2', start: '2019-03-04', end: '2019-03-05', User: 'User2', ,
]
javascript jquery twig fullcalendar
javascript jquery twig fullcalendar
edited Mar 1 at 14:48
ADyson
26.5k112846
26.5k112846
asked Mar 1 at 9:45
KhalilKhalil
979
979
Implement your event source using this pattern: fullcalendar.io/docs/events-function . Then your function can get the currently selected user ID from the select box and send the value to the server as part of the ajax request. The server will then filter the returned data according to the user ID. The other part of this is that you need to handle the "change" event of the select box using JavaScript, and in that event handler you just run the "refetchEvents" method of fullCalendar to make it reload the data using the new value. Give that idea a try and post code if you get stuck.
– ADyson
Mar 1 at 9:59
For example, i'm admin and i want select an user by his name and show all his event in calendar
– Khalil
Mar 1 at 10:00
1
I am looking already. So two things: 1) it seems your Event class's "User" property is protected. So I'm not convinced this will get serialised to JSON - you may need to make it public instead of protected. 2) JS property names are case-sensitive. So even if "User" is serialised,event.USER
will not match it.event.User
should match it, if it's there. This is why I asked you to provide a sample of your JSON event data as returned by the server. Can you now do that please? Then I know exactly what data your JavaScript is trying to interact with.
– ADyson
Mar 1 at 14:25
1
Actually, I can prove the User property won't be serialised. Demo: sandbox.onlinephpfunctions.com/code/… . Whereas if you make it public, it will. Demo: sandbox.onlinephpfunctions.com/code/…
– ADyson
Mar 1 at 14:31
1
Ok so changeevent.USER
toevent.User
in your eventRender code and try again
– ADyson
Mar 1 at 14:36
|
show 13 more comments
Implement your event source using this pattern: fullcalendar.io/docs/events-function . Then your function can get the currently selected user ID from the select box and send the value to the server as part of the ajax request. The server will then filter the returned data according to the user ID. The other part of this is that you need to handle the "change" event of the select box using JavaScript, and in that event handler you just run the "refetchEvents" method of fullCalendar to make it reload the data using the new value. Give that idea a try and post code if you get stuck.
– ADyson
Mar 1 at 9:59
For example, i'm admin and i want select an user by his name and show all his event in calendar
– Khalil
Mar 1 at 10:00
1
I am looking already. So two things: 1) it seems your Event class's "User" property is protected. So I'm not convinced this will get serialised to JSON - you may need to make it public instead of protected. 2) JS property names are case-sensitive. So even if "User" is serialised,event.USER
will not match it.event.User
should match it, if it's there. This is why I asked you to provide a sample of your JSON event data as returned by the server. Can you now do that please? Then I know exactly what data your JavaScript is trying to interact with.
– ADyson
Mar 1 at 14:25
1
Actually, I can prove the User property won't be serialised. Demo: sandbox.onlinephpfunctions.com/code/… . Whereas if you make it public, it will. Demo: sandbox.onlinephpfunctions.com/code/…
– ADyson
Mar 1 at 14:31
1
Ok so changeevent.USER
toevent.User
in your eventRender code and try again
– ADyson
Mar 1 at 14:36
Implement your event source using this pattern: fullcalendar.io/docs/events-function . Then your function can get the currently selected user ID from the select box and send the value to the server as part of the ajax request. The server will then filter the returned data according to the user ID. The other part of this is that you need to handle the "change" event of the select box using JavaScript, and in that event handler you just run the "refetchEvents" method of fullCalendar to make it reload the data using the new value. Give that idea a try and post code if you get stuck.
– ADyson
Mar 1 at 9:59
Implement your event source using this pattern: fullcalendar.io/docs/events-function . Then your function can get the currently selected user ID from the select box and send the value to the server as part of the ajax request. The server will then filter the returned data according to the user ID. The other part of this is that you need to handle the "change" event of the select box using JavaScript, and in that event handler you just run the "refetchEvents" method of fullCalendar to make it reload the data using the new value. Give that idea a try and post code if you get stuck.
– ADyson
Mar 1 at 9:59
For example, i'm admin and i want select an user by his name and show all his event in calendar
– Khalil
Mar 1 at 10:00
For example, i'm admin and i want select an user by his name and show all his event in calendar
– Khalil
Mar 1 at 10:00
1
1
I am looking already. So two things: 1) it seems your Event class's "User" property is protected. So I'm not convinced this will get serialised to JSON - you may need to make it public instead of protected. 2) JS property names are case-sensitive. So even if "User" is serialised,
event.USER
will not match it. event.User
should match it, if it's there. This is why I asked you to provide a sample of your JSON event data as returned by the server. Can you now do that please? Then I know exactly what data your JavaScript is trying to interact with.– ADyson
Mar 1 at 14:25
I am looking already. So two things: 1) it seems your Event class's "User" property is protected. So I'm not convinced this will get serialised to JSON - you may need to make it public instead of protected. 2) JS property names are case-sensitive. So even if "User" is serialised,
event.USER
will not match it. event.User
should match it, if it's there. This is why I asked you to provide a sample of your JSON event data as returned by the server. Can you now do that please? Then I know exactly what data your JavaScript is trying to interact with.– ADyson
Mar 1 at 14:25
1
1
Actually, I can prove the User property won't be serialised. Demo: sandbox.onlinephpfunctions.com/code/… . Whereas if you make it public, it will. Demo: sandbox.onlinephpfunctions.com/code/…
– ADyson
Mar 1 at 14:31
Actually, I can prove the User property won't be serialised. Demo: sandbox.onlinephpfunctions.com/code/… . Whereas if you make it public, it will. Demo: sandbox.onlinephpfunctions.com/code/…
– ADyson
Mar 1 at 14:31
1
1
Ok so change
event.USER
to event.User
in your eventRender code and try again– ADyson
Mar 1 at 14:36
Ok so change
event.USER
to event.User
in your eventRender code and try again– ADyson
Mar 1 at 14:36
|
show 13 more comments
2 Answers
2
active
oldest
votes
The problem is a simple one - JavaScript property names are case-sensitive.
Therefore, event.USER
will not match the User
property in your data.
Change event.USER
to event.User
and it will work.
Simple demo:
var events = [
title: 'Event1',
start: '2019-03-01',
end: '2019-03-02',
User: 'User1'
,
title: 'Event2',
start: '2019-03-01',
end: '2019-03-02',
User: 'User2'
];
events.forEach(eventRender);
function eventRender(event)
console.log ("Testing: " + JSON.stringify(event));
console.log("Bad code: " + (['', event.USER].indexOf("User1") >= 0));
console.log("Good code: " + (['', event.User].indexOf("User1") >= 0));
And here's a demo of the code in action within fullCalendar: http://jsfiddle.net/mw7okq9v/
One further point: Although your provided JSON data sample includes the User
property, it's unclear whether this accurately reflects the current state of what your code is actually outputting.
In your Event
class, you have specified this property as "protected". i.e.
protected $User;
This will prevent the property being included when the object is serialised to JSON. I think you will need to make it public:
public $User;
so that the server will output this property as part of the event JSON.
I have tried your code, it's work fine, but my case not work :( i think he don't read the attribute User from Database
– Khalil
Mar 1 at 15:01
Re-read the comments above, I already explained to you the likely way to solve that. I think it is probably being read from the database, but not serialised into JSON. However, the sample data you provided to me does contain theUser
property, and has valid values. So did you actually provide me the real data being output by your code, or just some sample of how you wanted it to look?
– ADyson
Mar 1 at 15:02
the probleme is here, eventRender: function eventRender(event, element) return ['', event.User].indexOf($('#school_selector').val()) >= 0 he can't read the data of event.User, and i haven't know how to fix this all of the day
– Khalil
Mar 1 at 16:50
I have fixed the probleme, every thing is okay, thank you Adyson for your support all of the day ^^
– Khalil
Mar 1 at 17:00
add a comment |
you can also put your user id in the filters
object
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
user_id: " app.user.id ",
,
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
And retrieve the value in the $filters
array of your listener,
then update the query to fit your needs
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('booking')
->where('booking.beginAt BETWEEN :startDate and :endDate')
->innerJoin('booking.user', 'user')
->andWhere('user.id = :userId')
->setParameter('userId', $filters['user_id'])
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54941901%2fhow-to-customize-data-fullcalendarbundle-from-a-submit-form%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is a simple one - JavaScript property names are case-sensitive.
Therefore, event.USER
will not match the User
property in your data.
Change event.USER
to event.User
and it will work.
Simple demo:
var events = [
title: 'Event1',
start: '2019-03-01',
end: '2019-03-02',
User: 'User1'
,
title: 'Event2',
start: '2019-03-01',
end: '2019-03-02',
User: 'User2'
];
events.forEach(eventRender);
function eventRender(event)
console.log ("Testing: " + JSON.stringify(event));
console.log("Bad code: " + (['', event.USER].indexOf("User1") >= 0));
console.log("Good code: " + (['', event.User].indexOf("User1") >= 0));
And here's a demo of the code in action within fullCalendar: http://jsfiddle.net/mw7okq9v/
One further point: Although your provided JSON data sample includes the User
property, it's unclear whether this accurately reflects the current state of what your code is actually outputting.
In your Event
class, you have specified this property as "protected". i.e.
protected $User;
This will prevent the property being included when the object is serialised to JSON. I think you will need to make it public:
public $User;
so that the server will output this property as part of the event JSON.
I have tried your code, it's work fine, but my case not work :( i think he don't read the attribute User from Database
– Khalil
Mar 1 at 15:01
Re-read the comments above, I already explained to you the likely way to solve that. I think it is probably being read from the database, but not serialised into JSON. However, the sample data you provided to me does contain theUser
property, and has valid values. So did you actually provide me the real data being output by your code, or just some sample of how you wanted it to look?
– ADyson
Mar 1 at 15:02
the probleme is here, eventRender: function eventRender(event, element) return ['', event.User].indexOf($('#school_selector').val()) >= 0 he can't read the data of event.User, and i haven't know how to fix this all of the day
– Khalil
Mar 1 at 16:50
I have fixed the probleme, every thing is okay, thank you Adyson for your support all of the day ^^
– Khalil
Mar 1 at 17:00
add a comment |
The problem is a simple one - JavaScript property names are case-sensitive.
Therefore, event.USER
will not match the User
property in your data.
Change event.USER
to event.User
and it will work.
Simple demo:
var events = [
title: 'Event1',
start: '2019-03-01',
end: '2019-03-02',
User: 'User1'
,
title: 'Event2',
start: '2019-03-01',
end: '2019-03-02',
User: 'User2'
];
events.forEach(eventRender);
function eventRender(event)
console.log ("Testing: " + JSON.stringify(event));
console.log("Bad code: " + (['', event.USER].indexOf("User1") >= 0));
console.log("Good code: " + (['', event.User].indexOf("User1") >= 0));
And here's a demo of the code in action within fullCalendar: http://jsfiddle.net/mw7okq9v/
One further point: Although your provided JSON data sample includes the User
property, it's unclear whether this accurately reflects the current state of what your code is actually outputting.
In your Event
class, you have specified this property as "protected". i.e.
protected $User;
This will prevent the property being included when the object is serialised to JSON. I think you will need to make it public:
public $User;
so that the server will output this property as part of the event JSON.
I have tried your code, it's work fine, but my case not work :( i think he don't read the attribute User from Database
– Khalil
Mar 1 at 15:01
Re-read the comments above, I already explained to you the likely way to solve that. I think it is probably being read from the database, but not serialised into JSON. However, the sample data you provided to me does contain theUser
property, and has valid values. So did you actually provide me the real data being output by your code, or just some sample of how you wanted it to look?
– ADyson
Mar 1 at 15:02
the probleme is here, eventRender: function eventRender(event, element) return ['', event.User].indexOf($('#school_selector').val()) >= 0 he can't read the data of event.User, and i haven't know how to fix this all of the day
– Khalil
Mar 1 at 16:50
I have fixed the probleme, every thing is okay, thank you Adyson for your support all of the day ^^
– Khalil
Mar 1 at 17:00
add a comment |
The problem is a simple one - JavaScript property names are case-sensitive.
Therefore, event.USER
will not match the User
property in your data.
Change event.USER
to event.User
and it will work.
Simple demo:
var events = [
title: 'Event1',
start: '2019-03-01',
end: '2019-03-02',
User: 'User1'
,
title: 'Event2',
start: '2019-03-01',
end: '2019-03-02',
User: 'User2'
];
events.forEach(eventRender);
function eventRender(event)
console.log ("Testing: " + JSON.stringify(event));
console.log("Bad code: " + (['', event.USER].indexOf("User1") >= 0));
console.log("Good code: " + (['', event.User].indexOf("User1") >= 0));
And here's a demo of the code in action within fullCalendar: http://jsfiddle.net/mw7okq9v/
One further point: Although your provided JSON data sample includes the User
property, it's unclear whether this accurately reflects the current state of what your code is actually outputting.
In your Event
class, you have specified this property as "protected". i.e.
protected $User;
This will prevent the property being included when the object is serialised to JSON. I think you will need to make it public:
public $User;
so that the server will output this property as part of the event JSON.
The problem is a simple one - JavaScript property names are case-sensitive.
Therefore, event.USER
will not match the User
property in your data.
Change event.USER
to event.User
and it will work.
Simple demo:
var events = [
title: 'Event1',
start: '2019-03-01',
end: '2019-03-02',
User: 'User1'
,
title: 'Event2',
start: '2019-03-01',
end: '2019-03-02',
User: 'User2'
];
events.forEach(eventRender);
function eventRender(event)
console.log ("Testing: " + JSON.stringify(event));
console.log("Bad code: " + (['', event.USER].indexOf("User1") >= 0));
console.log("Good code: " + (['', event.User].indexOf("User1") >= 0));
And here's a demo of the code in action within fullCalendar: http://jsfiddle.net/mw7okq9v/
One further point: Although your provided JSON data sample includes the User
property, it's unclear whether this accurately reflects the current state of what your code is actually outputting.
In your Event
class, you have specified this property as "protected". i.e.
protected $User;
This will prevent the property being included when the object is serialised to JSON. I think you will need to make it public:
public $User;
so that the server will output this property as part of the event JSON.
var events = [
title: 'Event1',
start: '2019-03-01',
end: '2019-03-02',
User: 'User1'
,
title: 'Event2',
start: '2019-03-01',
end: '2019-03-02',
User: 'User2'
];
events.forEach(eventRender);
function eventRender(event)
console.log ("Testing: " + JSON.stringify(event));
console.log("Bad code: " + (['', event.USER].indexOf("User1") >= 0));
console.log("Good code: " + (['', event.User].indexOf("User1") >= 0));
var events = [
title: 'Event1',
start: '2019-03-01',
end: '2019-03-02',
User: 'User1'
,
title: 'Event2',
start: '2019-03-01',
end: '2019-03-02',
User: 'User2'
];
events.forEach(eventRender);
function eventRender(event)
console.log ("Testing: " + JSON.stringify(event));
console.log("Bad code: " + (['', event.USER].indexOf("User1") >= 0));
console.log("Good code: " + (['', event.User].indexOf("User1") >= 0));
edited Mar 1 at 15:47
answered Mar 1 at 14:41
ADysonADyson
26.5k112846
26.5k112846
I have tried your code, it's work fine, but my case not work :( i think he don't read the attribute User from Database
– Khalil
Mar 1 at 15:01
Re-read the comments above, I already explained to you the likely way to solve that. I think it is probably being read from the database, but not serialised into JSON. However, the sample data you provided to me does contain theUser
property, and has valid values. So did you actually provide me the real data being output by your code, or just some sample of how you wanted it to look?
– ADyson
Mar 1 at 15:02
the probleme is here, eventRender: function eventRender(event, element) return ['', event.User].indexOf($('#school_selector').val()) >= 0 he can't read the data of event.User, and i haven't know how to fix this all of the day
– Khalil
Mar 1 at 16:50
I have fixed the probleme, every thing is okay, thank you Adyson for your support all of the day ^^
– Khalil
Mar 1 at 17:00
add a comment |
I have tried your code, it's work fine, but my case not work :( i think he don't read the attribute User from Database
– Khalil
Mar 1 at 15:01
Re-read the comments above, I already explained to you the likely way to solve that. I think it is probably being read from the database, but not serialised into JSON. However, the sample data you provided to me does contain theUser
property, and has valid values. So did you actually provide me the real data being output by your code, or just some sample of how you wanted it to look?
– ADyson
Mar 1 at 15:02
the probleme is here, eventRender: function eventRender(event, element) return ['', event.User].indexOf($('#school_selector').val()) >= 0 he can't read the data of event.User, and i haven't know how to fix this all of the day
– Khalil
Mar 1 at 16:50
I have fixed the probleme, every thing is okay, thank you Adyson for your support all of the day ^^
– Khalil
Mar 1 at 17:00
I have tried your code, it's work fine, but my case not work :( i think he don't read the attribute User from Database
– Khalil
Mar 1 at 15:01
I have tried your code, it's work fine, but my case not work :( i think he don't read the attribute User from Database
– Khalil
Mar 1 at 15:01
Re-read the comments above, I already explained to you the likely way to solve that. I think it is probably being read from the database, but not serialised into JSON. However, the sample data you provided to me does contain the
User
property, and has valid values. So did you actually provide me the real data being output by your code, or just some sample of how you wanted it to look?– ADyson
Mar 1 at 15:02
Re-read the comments above, I already explained to you the likely way to solve that. I think it is probably being read from the database, but not serialised into JSON. However, the sample data you provided to me does contain the
User
property, and has valid values. So did you actually provide me the real data being output by your code, or just some sample of how you wanted it to look?– ADyson
Mar 1 at 15:02
the probleme is here, eventRender: function eventRender(event, element) return ['', event.User].indexOf($('#school_selector').val()) >= 0 he can't read the data of event.User, and i haven't know how to fix this all of the day
– Khalil
Mar 1 at 16:50
the probleme is here, eventRender: function eventRender(event, element) return ['', event.User].indexOf($('#school_selector').val()) >= 0 he can't read the data of event.User, and i haven't know how to fix this all of the day
– Khalil
Mar 1 at 16:50
I have fixed the probleme, every thing is okay, thank you Adyson for your support all of the day ^^
– Khalil
Mar 1 at 17:00
I have fixed the probleme, every thing is okay, thank you Adyson for your support all of the day ^^
– Khalil
Mar 1 at 17:00
add a comment |
you can also put your user id in the filters
object
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
user_id: " app.user.id ",
,
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
And retrieve the value in the $filters
array of your listener,
then update the query to fit your needs
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('booking')
->where('booking.beginAt BETWEEN :startDate and :endDate')
->innerJoin('booking.user', 'user')
->andWhere('user.id = :userId')
->setParameter('userId', $filters['user_id'])
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
add a comment |
you can also put your user id in the filters
object
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
user_id: " app.user.id ",
,
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
And retrieve the value in the $filters
array of your listener,
then update the query to fit your needs
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('booking')
->where('booking.beginAt BETWEEN :startDate and :endDate')
->innerJoin('booking.user', 'user')
->andWhere('user.id = :userId')
->setParameter('userId', $filters['user_id'])
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
add a comment |
you can also put your user id in the filters
object
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
user_id: " app.user.id ",
,
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
And retrieve the value in the $filters
array of your listener,
then update the query to fit your needs
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('booking')
->where('booking.beginAt BETWEEN :startDate and :endDate')
->innerJoin('booking.user', 'user')
->andWhere('user.id = :userId')
->setParameter('userId', $filters['user_id'])
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
you can also put your user id in the filters
object
eventSources: [
url: " path('fullcalendar_load_events') ",
type: 'POST',
data:
filters:
user_id: " app.user.id ",
,
,
error: function ()
alert('There was an error while fetching FullCalendar!');
],
And retrieve the value in the $filters
array of your listener,
then update the query to fit your needs
public function loadEvents(CalendarEvent $calendar)
$startDate = $calendar->getStart();
$endDate = $calendar->getEnd();
$filters = $calendar->getFilters();
$bookings = $this->em->getRepository(Booking::class)
->createQueryBuilder('booking')
->where('booking.beginAt BETWEEN :startDate and :endDate')
->innerJoin('booking.user', 'user')
->andWhere('user.id = :userId')
->setParameter('userId', $filters['user_id'])
->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
->getQuery()->getResult();
foreach($bookings as $booking)
$bookingEvent = new Event(
$booking->getTitle(),
$booking->getBeginAt(),
$booking->getEndAt(),// If the end date is null or not defined, it creates a all day event
$booking->getUser()
);
$bookingEvent->setUrl(
$this->router->generate('booking_show', array(
'id' => $booking->getId(),
))
);
$calendar->addEvent($bookingEvent);
answered Mar 23 at 9:29
Théo AttaliThéo Attali
69657
69657
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54941901%2fhow-to-customize-data-fullcalendarbundle-from-a-submit-form%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Implement your event source using this pattern: fullcalendar.io/docs/events-function . Then your function can get the currently selected user ID from the select box and send the value to the server as part of the ajax request. The server will then filter the returned data according to the user ID. The other part of this is that you need to handle the "change" event of the select box using JavaScript, and in that event handler you just run the "refetchEvents" method of fullCalendar to make it reload the data using the new value. Give that idea a try and post code if you get stuck.
– ADyson
Mar 1 at 9:59
For example, i'm admin and i want select an user by his name and show all his event in calendar
– Khalil
Mar 1 at 10:00
1
I am looking already. So two things: 1) it seems your Event class's "User" property is protected. So I'm not convinced this will get serialised to JSON - you may need to make it public instead of protected. 2) JS property names are case-sensitive. So even if "User" is serialised,
event.USER
will not match it.event.User
should match it, if it's there. This is why I asked you to provide a sample of your JSON event data as returned by the server. Can you now do that please? Then I know exactly what data your JavaScript is trying to interact with.– ADyson
Mar 1 at 14:25
1
Actually, I can prove the User property won't be serialised. Demo: sandbox.onlinephpfunctions.com/code/… . Whereas if you make it public, it will. Demo: sandbox.onlinephpfunctions.com/code/…
– ADyson
Mar 1 at 14:31
1
Ok so change
event.USER
toevent.User
in your eventRender code and try again– ADyson
Mar 1 at 14:36