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

Event Item

Asked by Bret
26 days ago.

Can I display more than one field on an event in the resource calendar?

Answer posted by Dan Letecky [DayPilot]
26 days ago.

By default, the calendar displays the value of the "text" property in the event boxes.

If you want to display more data, you can customize the event content using onBeforeEventRender event handler:
https://doc.daypilot.org/calendar/event-customization/

Example:

onBeforeEventRender: (args) => {
  args.data.text = `${args.data.text} ${args.data.myField}`; 
}

This assumes the event data item has "myField" property:

const events = [
  {
    start: "2023-05-06T12:00:00",
    end: "2023-05-06T14:00:00",
    id: 1,
    text: "Event 1",
    myField: "my value"
  }
];

You can also use "args.data.html" to set custom raw HTML but don't forget to HTML-encode the user-provided values in this case (you can use DayPilot.Util.escapeHtml(text) to do that).

New Reply
This reply is
Attachments:
or drop files here
Your name (optional):