Permalink
Browse files

fix up for sparse calendar provider array

  • Loading branch information...
tardate committed Aug 11, 2010
1 parent 9f945c6 commit 4bf0ecc019112a52fcd498dc34ef53f09c9bed51
Showing with 5 additions and 2 deletions.
  1. +5 −2 jquery.addtocal.js
View
@@ -103,7 +103,10 @@
select: function(event, ui) {
var eventDetails = ui.sanitizeEventDetails( ui.getEventDetails($(this)) );
- var link = ui.calendars[ ui.selectedCalendarTarget ].formatlink(eventDetails);
+ var calendar_provider = $.grep(ui.calendars, function(element, index){
+ return (element.value == ui.selectedCalendarTarget);
+ });
+ var link = calendar_provider[0].formatlink(eventDetails);
if(link) window.open(link);
},
},
@@ -169,7 +172,7 @@
var self = this;
self.source=[];
$.each( this.options.calendars, function(index, value) {
- if(value.enabled(self)) self.source.push( {value: index, label: value.label } );
+ if(value.enabled(self)) self.source.push( {value: value.value, label: value.label } );
});
},

0 comments on commit 4bf0ecc

Please sign in to comment.