Skip to content

Commit 279e5f7

Browse files
committed
Error Loading data view without context
Check the Content of the context entity is set before rendering. Suggested also hide the domNode if context is empty, in case some case the context entity will be empty after being rendered for the first time Should, the display should happen before or after the _loadData function?
1 parent 205f6a2 commit 279e5f7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/ChartJS/widgets/Core.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,18 @@ define([
130130
if (this._handle !== null) {
131131
mx.data.unsubscribe(this._handle);
132132
}
133-
this._handle = mx.data.subscribe({
134-
guid: this._mxObj.getGuid(),
135-
callback: lang.hitch(this, this._loadData)
136-
});
137-
138-
// Load data again.
139-
this._loadData();
140-
133+
if(this._mxObj) {
134+
this._handle = mx.data.subscribe({
135+
guid: this._mxObj.getGuid(),
136+
callback: lang.hitch(this, this._loadData)
137+
});
138+
139+
// Load data again.
140+
this._loadData();
141+
domStyle.set(this.domNode, "display", "");
142+
} else {
143+
domStyle.set(this.domNode, "display", "none");
144+
}
141145
if (typeof callback !== "undefined") {
142146
callback();
143147
}

0 commit comments

Comments
 (0)