views:

78

answers:

1

I am wrestling with figuring out how to open a FullCalendar event URL in a modal dialog using jQuery UI Dialog. I know next to nothing about javascript, so I'm not sure how the call syntax is supposed to look.

I figure I'm supposed to use the eventClick option, but I cannot figure out how to use it to instantiate the dialog. Any help?

My calendar generating script looks like this:

<script type="text/javascript">

$(document).ready(function() { var $dialog = $('')

$('#calendar').fullCalendar({
  header: {
    left: 'month,agendaWeek,agendaDay',
    center: 'title',
    right: 'today prev,next'
  },
  allDayDefault: false,
  editable: false,
  eventSources: ['[[~96]]'],
  eventClick: function(event) {
    if (event.url) {
      $dialog
        .load(event.url)
        .dialog({
          autoOpen: false,
          width: 500,
          height:300
        });
      $dialog.dialog('open');
      return false;
    };
  };
});

});

+1  A: 

You have to declare some div for dialog in your page, for example:

<div id="myDialog"></div>

...

$(document).ready(function() {
$('#calendar').fullCalendar({
...
eventClick: function(event) {
    if (event.url) {
      $('#myDialog')
        .load(event.url)
        .dialog({
          width: 500,
          height:300
        });
      return false;
    };
katrin
True. I finally got the issue resolve, though using the var $dialog = $('<div></div>') technique so as to avoid having an empty div on my page. http://blog.nemikor.com/2009/08/07/creating-dialogs-on-demand/
CwnAnnwn