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

How to display event details in cell with new line (\n) ?

Asked by Desakumaaran
2 years ago.

Need to display "Test1 \n Test2" in cell with line brake.
like below :-
Test1(line 1)
Test2(line 2)

Answer posted by Dan Letecky [DayPilot]
2 years ago.

To add line breaks to Scheduler event text, you need to use the "html" property and insert "<br>" tags. The text provided using the "text" property will be HTML-encoded automatically (XSS protection is enabled by default).

This can be done on the server side (you can send the desired HTML) or you can convert the text to HTML on the client side using onBeforeEventRender event (https://api.daypilot.org/daypilot-scheduler-onbeforeeventrender/).

The following example will convert '\n' characters in the text to "<br>" tags and HTML-encode the other content:

onBeforeEventRender: args => {
  const lines = args.data.text.split("\n").map(line => DayPilot.Util.escapeHtml(line));
  args.data.html = lines.join("<br>");
}
Comment posted by Desakumaaran
2 years ago.

Thanks. Its Working !

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.