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

Unable to dp.init() in Lightning Web Component

Asked by Thaddeus
11 months ago.

Using the javascript scheduler capability the following error message is returned when attempting to init() the scheduler instance.

DayPilot.Scheduler: The placeholder element not found: 'dp'.

How is the element placeholder passed to the div class?


        <div class="dp" lwc:dom="manual" style='width: 100%;' id="dp"></div>


        const dp = new window.DayPilot.Scheduler("dp", {
            timeHeaders: [{"groupBy":"Year"},{"groupBy":"Month"},{"groupBy":"Day","format":"d"}],
            scale: "Day",
            days: "365",
            startDate: "2023-01-01",
            showNonBusiness: false,
            eventMovingStartEndEnabled: true,
            timeRangeSelectedHandling: "Enabled",
            onTimeRangeSelected: async (args) => {
              const dp = args.control;
              const modal = await DayPilot.Modal.prompt("Create a new event:", "Event 1");
              if (modal.canceled) { return; }
                start: args.start,
                end: args.end,
                id: DayPilot.guid(),
                resource: args.resource,
                text: modal.result
            treeEnabled: true,

        dp.resources = [
    ]; = [  {

Answer posted by Dan Letecky [DayPilot]
11 months ago.

LWC uses virtual DOM so you will need to adjust the code a bit.

1. Make sure that the init code is in renderedCallback(). This ensures that the placeholder will be available.
2. The DayPilot.Scheduler constructor accepts either the placeholder id (string) or the DOM element ( In this case, you will need to get a DOM element reference using this.template.querySelector() - see

const el = this.template.querySelector('#dp');
const dp = new window.DayPilot.Scheduler(el, { ... });
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.