DayPilot Pro 5.0

Released on October 4, 2008 (build 1536).

Main features

(F80) DayPilot Scheduler performance boost

DayPilot Scheduler was rewritten to be able to handle large data sets. Several speed-optimization features were ported from DayPilot Dynamic Scheduler.

The changes include:

1. Dynamic background cell loading

Up to DayPilot Pro 4.9 SP3, the background cells were rendered all at once during the initial load (and during Refresh callback) in one big table. This caused significant performance problem when rendering large areas (one year, 20+ resources).

DayPilot Pro 5.0 will render only the current viewport during the initial rendering and it will add the missing areas during scrolling.

  • The visited areas are cached (no need to redraw them when you scroll back).
  • The cache is cleared after the first callback (either move/resize or refresh).
  • All the background data are loaded at the beginning.
  • All the event data are both loaded and rendered at the beginning.

Differences from DayPilot Dynamic Scheduler:

  • DayPilot Dynamic Scheduler loads everything on demand (both background cells and events). That means the server is always contacted during scrolling.
  • DayPilot Dynamic Scheduler doesn't do any caching (server is contacted for the visited areas as well).

2. Time cell data format is optimized (JSON)

In DayPilot Pro 5.0, the cell data format is optimized.

Old format:

v.colors = [["#FFFFD5","#FFFFD5","#FFFFD5","#FFFFD5","#FFF4BC", ...

New format:

v.colors = [[0,0,0,0,1, ...
v.palette = ["#FFFFD5","#FFF4BC"];

This reduces the size of the array to 20% of the original size. This change will improve performance of the initial loading and all callbacks and postbacks.

3. Event data format is optimized (JSON)

The event data are passed as a plain array instead of an associative array.

Old format:

v.events = [{"ToolTip":"Event 1 (3:50 PM - 3:50 PM)","PartStart":"September 18, 2008 15:50:00 +0000","Box":true, ...

New format:

v.events = [["Event 1 (3:50 PM - 3:50 PM)","September 18, 2008 15:50:00 +0000",true, ...

This reduces the events array size to 50% of the original size. This change will improve performance of the initial loading and all callbacks and postbacks.

4. Selective element purging

In release 4.9 SP1DayPilot Scheduler introduced a special purging method (DayPilot.pu()) that was called before deleting DOM elements in order to prevent memory leaking. However, this method was very slow (recursing through all the children). It was replaced by a selective event handler purging (deleting exactly the needed event handlers) and the required time was reduced to 20%.

This applies to all callbacks and partial postbacks (UpdatePanel).

(F84) Configurable callback Update() (DayPilot Scheduler)

The current behavior of server-side Update() method in DayPilot Scheduler depends on the event handler:

  • Refresh event: Update() redraws almost the whole control (events, headers, and background cells)
  • EventMove, EventResize and other events: Update() redraws events only

In DayPilot Pro 5.0, the Update() method has a new parameter that specifies what should be updated:

public void Update(CallBackUpdateType updateType);

CallBackUpdateType is an enum with the following values:

  • None
  • EventsOnly
  • Full

EventsOnly is the default value and it corresponds to the previous behavior. Full value reloads both events and headers (including the upper-left corner, see also forums.daypilot.org/Topic.aspx/561/how_to_update_the_content_of_top_left_corner_cell_on_schedul).

(F85) Command event (flexible replacement for Refresh) (DayPilot Scheduler)

The refreshCallBack() client-side method is now deprecated in favor of a new commandCallBack().

Declaration

commandCallBack(command, data);

Parameters

  • command (string) - custom command type string
  • data (any JavaScript object) - custom data that will be sent to the server-side Command handler

The data parameter will be translated into JsonData class - see also (F57) Sending custom data with CallBack (DayPilot Scheduler) below.

Example (switching to a specified year)

Demo/Scheduler/Default.aspx:

<a href="javascript:dps1.commandCallBack('year', 2008);">Next</a>

Demo/Scheduler/Default.aspx.cs:

    protected void DayPilotScheduler1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
    {
        switch (e.Command)
        {
            case "year":
                DayPilotScheduler1.StartDate = new DateTime((int)e.Data, 1, 1);
                DayPilotScheduler1.Days = Year.Days(DayPilotScheduler1.StartDate.Year);
                break;
            // ...         }         // ...
        DayPilotScheduler1.DataBind();
        DayPilotScheduler1.Update(CallBackUpdateType.Full);
    }

Status: Implemented

(F57) Sending custom data with CallBack (DayPilot Scheduler)

All client-side callback methods of DayPilot Scheduler have an extra parameter (data) that will allow you to send additional information to the server.

Smart object handling

  • You can send any kind of object (int, string, Date, array, object...).
  • The JavaScript object is accessible using a string indexer (e.g. e.Data["property"]).
  • You can access the full hierarchy without casting the individual levels (e.g. e.Data["property"]["item"]["subitem"]).
  • The JavaScript array is accessible using a int indexer (e.g. e.Data[0]).
  • You can convert the parameter value directly by casting in most cases (e.g. (string) e.Data will convert int value to string).

The "data" parameter will be translated into a JsonData class instance. JsonData is a polymorphic element that mimics an untyped JavaScript object.

Depending on the "data" content, it can be accessed in various ways:

  • string: (string) e.Data
  • integer: (int) e.Data
  • Date: (DateTime) e.Data
  • DayPilot.Date: (DateTime) e.Data
  • array: e.Data[0]
  • object with properties: e.Data["property"]
  • object hierarchy: e.Data["item"]["subitem"]

Example 1 (simple string)

Client side:

var state = "on";
dps1.eventClickCallBack(e, state);

Server side:

protected void DayPilotScheduler1_EventClick(object sender, DayPilot.Web.Ui.Events.EventClickEventArgs e)
{
   string state = (string) e.Data;
}

Example 2 (Date object)

Date object always sends its UTC value (not local time).

Client side:

var date = new Date();
dps1.eventClickCallBack(e, date);

Server side:

protected void DayPilotScheduler1_EventClick(object sender, DayPilot.Web.Ui.Events.EventClickEventArgs e)
{
// be careful, this date doesn't correspond to the client
// local time unless you are in +00 time zone
   DateTime date = (DateTime) e.Data;
}

Example 3 (DayPilot.Date object)

DayPilot.Date object ignores the time zones and sends exactly what you supply. The constructor (new DayPilot.Date()) creates a new date using the current local time.

Client side:

var date = new DayPilot.Date();
dps1.eventClickCallBack(e, date);

Server side:

protected void DayPilotScheduler1_EventClick(object sender, DayPilot.Web.Ui.Events.EventClickEventArgs e)
{
   DateTime date = (DateTime) e.Data;  
}

Example 5 (array)

Client side:

var myArray = ['a', 'b', 'c'];
dps1.eventClickCallBack(e, myArray);

Server side:

protected void DayPilotScheduler1_EventClick(object sender, DayPilot.Web.Ui.Events.EventClickEventArgs e)
{
   string a = (string) e.Data[0];  
}

Example 4 (object)

You can send any object. It will be accessible as a Dictionary hieararchy.

Client side:

var o = {};
o.name = "name";
o.value = "value";
o.child = {};
o.child.name = "child name";
o.child.value = "child value";
dps1.eventClickCallBack(e, o);

Server side:

protected void DayPilotScheduler1_EventClick(object sender, DayPilot.Web.Ui.Events.EventClickEventArgs e)
{
   string childValue = (string) e.Data["child"]["value"];
}

Methods affected

  • eventClickCallBack(e, data)
  • rightClickCallBack(e, data)
  • eventResizeCallBack(e, newStart, newEnd, data)
  • eventMoveCallBack(e, newStart, newEnd, oldColumn, newColumn, data)
  • eventMenuClickCallBack(e, command, data)
  • timeRangeSelectedCallBack(start, end, column, data)
  • eventEditCallBack(e, newText, data)
  • refreshCallBack(start, days, data)
  • commandCallBack(data)

See also:

Status: Implemented

(F78) Firefox 3 support (all controls)

Known issues:

Status: Implemented

(F75) Safari 3 support (all controls)

Fixed Safari 3 issues:

DayPilot Calendar

  • event moving (status: fixed)
  • selecting time range (status: fixed)

DayPilot Scheduler

  • width in percent (status: fixed)
  • selecting free time (status: fixed)

DayPilot Month

  • it flickers when moving and resizing (it selects and deselects the background) (status: fixed)

DayPilot Dynamic Scheduler

  • it flickers when moving an event (status: fixed)

Status: Implemented

(F82) Google Chrome support (all controls)

DayPilot Scheduler now works properly in Google Chrome.

Status: Implemented

(F76) Opera 9 support (all controls)

Known issues:

  • Time range selecting doesn't work (case 1642) (status: fixed)

Status: Implemented

(F83) DayPilot.Date object (DPS)

A new object is used to represent the date information passed to client-side event handlers (JavaScript).

Differences from the standard Date object:

  • DayPilot.Date only works with a single time zone (no distinction between local and GMT time).
  • Supports methods for easier handling of calculations (addMinutes, etc.).

Event-handlers that use this DayPilot.Date:

  • EventClickJavaScript: e.start(), e.end()
  • EventEditJavaScript: e.start(), e.end()
  • EventMoveJavaScript: e.start(), e.end(), newStart, newEnd
  • EventResizeJavaScript: e.start(), e.end(), newStart, newEnd
  • EventRightClick: e.start(), e.end()
  • TimeRangeSelected: start, end

Methods:

DayPilot.Date(date, isLocal) - constructor

Parameters:

  • date (Date) - Date object which should be used to set the initial value. If it is null, current local date and time will be used.
  • isLocal (bool) - if true, the date parameter is read as local time

DayPilot.Date.addDays(days)

Adds the specified number of days to the value of this instance. Returns a new DayPilot.Date object. The current value is not changed.

Parameters:

  • days (int)

DayPilot.Date.addHours(hours)

Adds the specified number of hours to the value of this instance. Returns a new DayPilot.Date object. The current value is not changed.

Parameters:

  • hours (int)

DayPilot.Date.addMilliseconds(millis)

Adds the specified number of milliseconds to the value of this instance. Returns a new DayPilot.Date object. The current value is not changed.

Parameters:

  • milliseconds (int)

DayPilot.Date.addMinutes(minutes)

Adds the specified number of minutes to the value of this instance. Returns a new DayPilot.Date object. The current value is not changed.

Parameters:

  • minutes (int)

DayPilot.Date.addMonths(months)

Adds the specified number of months to the value of this instance. Returns a new DayPilot.Date object. The current value is not changed.

Parameters:

  • months (int)

DayPilot.Date.addSeconds(seconds)

Adds the specified number of seconds to the value of this instance. Returns a new DayPilot.Date object. The current value is not changed.

Parameters:

  • seconds (int)

DayPilot.Date.addTime(ticks)

Adds the specified number of ticks (milliseconds) to the value of this instance. Returns a new DayPilot.Date object. The current value is not changed.

Parameters:

  • ticks (int)

DayPilot.Date.clone()

Returns a new DayPilot.Date object with the same value.

DayPilot.Date.equals(another)

Returns true if the value of this object equals to the value of the compared DayPilot.Date object.

Parameters:

  • another (DayPilot.Date)

DayPilot.Date.getDay()

Returns the day of month (int).

DayPilot.Date.getDatePart()

Returns the date part of this object (DayPilot.Date).

DayPilot.Date.getYear()

Returns the year (int).

DayPilot.Date.getHours()

Returns the hour (int).

DayPilot.Date.getMilliseconds()

Returns the milliseconds (int).

DayPilot.Date.getMinutes()

Returns the minutes (int).

DayPilot.Date.getMonth()

Returns the month (int). It's exactly the month number, not an index like in the standard Date object.

DayPilot.Date.getSeconds()

Returns the seconds (int).

DayPilot.Date.getTotalTicks()

Returns the total milliseconds since 1970 (int). Corresponds to Date.getTime().

DayPilot.Date.getTimePart()

Returns the milliseconds (int).

DayPilot.Date.toString()

Returns the string representation created using the local date/time format.

DayPilot.Date.toStringSortable()

Returns the date in sortable format (string). Corresponds to DateTime.ToString("s").

Improvements

1. EventBackColor added to DayPilot Dynamic Scheduler

Event background color can be changed:

  • globally for all events (EventBackColor property)
  • per event (in BeforeEventRender event handler, BeforeEventRenderEventArgs.BackgroundColor property)

2. EventBorderColor added to DayPilot Dynamic Scheduler

Event border color can be changed:

  • globally for all events (EventBorderColor property)

3. DurationBarColor added to DayPilot Dynamic Scheduler

Duration bar color can be changed:

  • globally for all events (DurationBarColor property)

Bug fixes

1. Multiple DayPilot Calendar controls on one page were not working

Not working since DayPilot Pro 4.9 SP3 (the init delaying code was using a global variable, not specific for a control ID).

 

Main menu

DayPilot for JavaScript, ASP.NET WebForms, ASP.NET MVC, Java