Hi there,
After an NPM update where we updated from ej2-vue-layouts 18.2.58 to the 18.3.x version, we suddenly encountered an issue with our dynamic widget approach.
To load widgets in the dashboard component, we use an vue property with foreach
<e-panels>
<e-panel
v-for="(item, index) in widgetSet"
:key="index"
:id="item.id"
:row="item.row"
:col="item.col"
:sizeX="item.sizeX"
:sizeY="item.sizeY"
:minSizeX="item.minSizeX"
:minSizeY="item.minSizeY"
:cssClass="item.class"
:header="'<div>' + item.name + '</div>'"
:content="item.widgetTemplate"
/>
</e-panels>
</ejs-dashboardlayout>
This worked without issue, but now, when we update the "widgetSet" property, the resetLayout cannot find the DOM element anymore, probably because this event is triggered before vue creates the new dom elements based on the updated property.
Console error:
dashboard.js:2 TypeError: Cannot read property 'id' of null
debugged in this part of your source, it calls "document.getElementById(this.panels[i].id)", but the DOM doesn't have this element yet. It fails on var rowValue = this.cloneObject[element_1.id].row;
DashboardLayout.prototype.resetLayout = function (model, element) {
var collisions = this.collisions(model.row, model.col, model.sizeX, model.sizeY, this.mainElement);
if (!this.mainElement || this.addPanelCalled || this.resizeCalled || this.movePanelCalled) {
return collisions;
}
if (this.mainElement && this.oldRowCol !== this.cloneObject) {
for (var i = 0; i < this.panels.length; i++) {
var element_1 = document.getElementById(this.panels[i].id);
if (element_1 === this.mainElement) {
continue;
}
var rowValue = this.cloneObject[element_1.id].row;
Our solution for now is revert to the 18.2.x version, but we would like to be able to stay "in sync" with your latest versions. Looking at the changelog, it probably has something todo with the fixes for the panels created in the 18.3.x releases.