search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Creating client-side DayPilotCalendar.Event object to pass to eventClickPostBack

Asked by Boyd
12 years ago.

Hello,

I'm trying to help a colleague of mine perform a pretty simply action. For each event they need to render several links on the event which when clicked will popup an UpdatePanel based on the link they clicked. We've got this working nice and well but it isn't ideal because I've made my own javascript object with the start(), end(), value(), etc. functions.

I would like to know how what data I need to construct the DayPilotCalendar.Event object. I've inspected the javascript source as far as I could and found it expects two arguments $d and $t. Additionally $d requires a property named Data which then contains all of the start, end, value, etc. data. Beyond this I couldn't really find too much information available for the client-side aspect of the control.

So, I have two questions; does anybody have any idea what I am talking about and how do I create a DayPilotCalendar.Event object?

Answer posted by Dan Letecky
12 years ago.
The DayPilotCalendar.Event is now rather an internal object.

I would like to make it more accessible for the future.

Depending on what exactly you need to send back to the server, you can create your own object (that's the beauty of JavaScript). You only need to define the required functions

Here is an example helping object that is defined in Common.js (it's a helper for external drag&drop):

DayPilot.Event = function(id, duration, text) {
this.value = function() { return id};
this.tag = function() { return null };
this.start = function() { return new Date(0) };
this.end = function() { return new Date( duration * 1000 ); };
this.text = function() { return text; };
this.isAllDay = function() { return false; };
};

These are the functions that are called from eventClickCallBack():
  • e.value() - string
  • e.tag() - see below
  • e.start() - Date object with date defined in +0000 time zone
  • e.end() - Date object with date defined in +0000 time zone
  • e.text() - string
  • e.column() - string
  • e.isAllDay() - boolean
e.tag() (called without parameters) should return a collection of encodeURIComponent'ed tag values joint using '&' character. The number of values must match the number of columns defined in DataTagFields property. Example:

DataTagFields="first,second"

e.tag = function() {
return encodeURIComponent("firstValue") + "&" + encodeURIComponent("secondValue");
};

I hope this helps a little bit...
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.