Make add / edit in dashboard interactive, and pass on data

This commit is contained in:
Stephen Abello
2026-01-09 16:31:36 +01:00
parent 7b193dd737
commit 3c365fc103
6 changed files with 132 additions and 22 deletions

View File

@@ -55,6 +55,18 @@ class IboGrid extends HTMLElement {
}
}
GetDashletElement(sDashletId) {
const aSlots = this.getSlots();
for (let oSlot of aSlots) {
if (oSlot.oDashlet && oSlot.oDashlet.sDashletId === sDashletId) {
return oSlot.oDashlet;
}
}
return null;
}
AddDashlet(sDashlet, aOptions = {}) {
// Get the dashlet as an object
const oParser = new DOMParser();
@@ -73,6 +85,16 @@ class IboGrid extends HTMLElement {
return oDashlet.sDashletId;
}
RefreshDashlet (sDashlet, aOptions = {}) {
const oParser = new DOMParser();
const oDocument = oParser.parseFromString(sDashlet, 'text/html');
const oNewDashlet = oDocument.body.firstChild;
debugger;
// Can't use oNewDashet.sDashletId as it's not in the DOM yet and connectedCallback hasn't been called yet
const oExistingDashlet = this.GetDashletElement(oNewDashlet.getAttribute('data-dashlet-id') );
oExistingDashlet.replaceWith(oNewDashlet);
}
CloneDashlet(sDashletId) {
const aSlots = this.getSlots();
for (let oSlot of aSlots) {