1

I am trying to access the event in a function that is not in the fullCalendar, I have a context menu that you can right click and choose DeleteEvent and it passes the target to the function:

var $target = $(e.target);
DeleteEvent($target);

When I use the debugger in chrome I can see the object I need but I can't figure out how to get to it because the numbers at the end of jquery could probably change.

So how do I write this to work everytime?

$target.context.offsetParent.jQuery224054666921681718872.fcSeg.event

I tried:

$target.context.offsetParent.find('fcSeg').event
$target.context.offsetParent.jQuery().fcSeg.event
$target.offsetParent().find('fcSeg').event
$target.offsetParent().closest('fcSeg').event

etc. Just grasping at straws here.

Devnsyde
  • 1,297
  • 1
  • 13
  • 34

1 Answers1

1

If you only want to delete an event after right click, popup menu and delete so it is better if you'll keep a var named activeEvent and every time you click on event you'll assign the event object to the var and then you can do whatever you want with it.

Eyal Abir
  • 1,080
  • 8
  • 11
  • That isn't an option, The context menu is also in a separate function and not tied to fullCalendar in anyway except it uses a class as its selector. I need an answer on how to get the fcSeg.event. If there was an event for right click like there is for click then that would be something I would have gone with. – Devnsyde Aug 19 '16 at 16:39
  • 1
    You can bind the right click to the event. There is an example in this question http://stackoverflow.com/questions/20610774/click-event-in-jquery-and-right-mouse-clicking – Eyal Abir Aug 20 '16 at 00:31
  • Great that works too, I had figured out how to bind to the right click, just a different way ( through eventRender: function(event, element){element.bind('mousedown', function(e){if(e.which==3)....}} ) and then I set a global var and accessed it as you said, you should update your answer to show how that is done so others who stumble here will get their help. – Devnsyde Aug 22 '16 at 15:14
  • also thumbs up for thinking outside the box :) – Devnsyde Aug 22 '16 at 15:15