| Issue 1325: | Trigger dayClick programmatically with jQuery.trigger | |
| 3 people starred this issue and may be notified of changes. | Back to list |
Consider the following code
$(".fc-day10:first").trigger("click")
I am expecting this to have the same effect as left clicking fc-day10 manually with the mouse. However, it does not. I also tried:
$(".fc-day10:first").trigger("click", {"which": 1})
Looking at the code I am suspect I might have to use a combination like mousedown and then mouseup. I would really like to be able to trigger dayClick programmatically for testing.
Related is the following posts and stack overflow:
http://stackoverflow.com/questions/3931103/intergration-tests-for-fullcalendar
http://stackoverflow.com/questions/6134708/selenium-click-not-working-on-some-anchor-elements
Mar 4, 2012
My issue is triggering dayClick without having access to the fullCalendar object. Say for example you were writing self contained test scripts that do not have access to the application javascript code.
But to answer the question above, if you have access to the fullCalendar object, you can trigger dayClick by doing:
.fullCalendar( 'gotoDate', year [, month, [ date ]] )
.fullCalendar('changeView', 'basicDay')
See http://arshaw.com/fullcalendar/docs/current_date/gotoDate/
And http://arshaw.com/fullcalendar/docs/views/changeView/
Mar 5, 2012
Thanks for the quick reply, and suggestion. But these 2 methods do not actually trigger the dayClick function.
I have some code in dayClick to highlight the td box of the day click:
$(this).css('background-color', '#FFFFCC');
dayClick: "Within the callback function, this is set to the <td> of the clicked day"
I want to do the same thing when an event is clicked, eventClick, but I do not have access to the td box. So, if I could just trigger dayClick, this would solve this.
I do have access to the fullCalendar object, so not the same reasons. But I still would like the ability to trigger the dayClick function.
Aug 15, 2013
this probably has something to do with the selection-based code intercepting mousedown/mouseup events internally in fullcalendar. you might want to listen for those instead. can't give you much more support than that, b/c this is a rather hacky thing you're doing. hopefully the api will improve in the future so that you can do this better. not sure the end-goal you are trying to achieve with this.
Status:
Done
Labels: -Type-Defect |
|
| ► Sign in to add a comment |
I'd like to trigger dayClick like this: $('#calendar').fullCalendar('dayClick', calEvent.start, true, jsEvent, view);