AnsweredAssumed Answered

TypeError: Cannot read property 'createElement' of undefined

Question asked by LTS_DSolari on Jun 21, 2019
Latest reply on Nov 29, 2019 by mattias.ekmanesri-se-esridist

I'm trying to create a widget in 4.11 and I'm getting the titular error. The traceback doesn't extend past the library code so I have no idea what part of my code actually causes the error, although my last breakpoint is at the widget's render function. I've attached my entire project (run "npm install; npm start" to build it and spin up a local web server) and I've pasted the main widget code below.

 

/// <amd-dependency path="esri/core/tsSupport/declareExtendsHelper" name="__extends" />
/// <amd-dependency path="esri/core/tsSupport/decorateHelper" name="__decorate" />

import { declared, property, subclass, aliasOf } from "esri/core/accessorSupport/decorators";
import { renderable, tsx } from "esri/widgets/support/widget";
import TimeSliderVM, { TimeExtent } from "./TimeSliderVM";

import Widget = require("esri/widgets/Widget");

@subclass("ledcor.gis.widgets.TimeSlider")
export default class TimeSlider extends declared(Widget) {

@property()
viewModel: TimeSliderVM

@property()
@renderable()
@aliasOf("viewModel.currentTime")
currentTime: Date

@property()
@renderable()
@aliasOf("viewModel.extent")
extent: TimeExtent

constructor(start: Date, end: Date, current?: Date, params?: Partial<__esri.WidgetProperties>) {
super(params);
this.viewModel = new TimeSliderVM(start, end, current);
}

async _onClick(e: Event) {
this.viewModel.currentTime = new Date()
}

render() {
return (
<div class="esri-widget">
<h3>Time Slider</h3>
</div>
);
}
}

 

Any help is appreciated, thank you!

Attachments

Outcomes