Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144878 | May 27,2019 12:17 PM UTC | May 28,2019 11:48 AM UTC | Angular - EJ 2 | 1 |
![]() |
Tags: DashboardLayout |
// Button click event function
assignPanel() {
// Local data is used here, you can replace it with the data returned from server
this.panels = [
{ "sizeX": 1, "sizeY": 1, "row": 0, "col": 0, content: '<div class="content">0</div>' },
{ "sizeX": 3, "sizeY": 2, "row": 0, "col": 1, content: '<div class="content">1</div>' },
{ "sizeX": 1, "sizeY": 1, "row": 0, "col": 4, content: '<div class="content">2</div>' },
{ "sizeX": 1, "sizeY": 1, "row": 1, "col": 0, content: '<div class="content">3</div>' },
{ "sizeX": 1, "sizeY": 1, "row": 1, "col": 4, content: '<div class="content">4</div>' },
];
// Assign the panels data to the dashboard layout’s panel property
this.dashboardObject.panels = this.panels;
} |
addPanel() {
// Local data is used here, you can replace it with the data returned from server
let panel: PanelModel[] = [{
id: 'panel_0' + this.count.toString(), 'sizeX': 1, 'sizeY': 1, 'row': 0, 'col': 0,
content: '<div class="content">0' + this.count.toString() + '</div>'
}];
this.dashboardObject.addPanel(panel[0]);
// Here count is used simply for calculating the total panels dynamically added
this.count++;
} |
this.panels = [
{ "id": ’panel_0’, "sizeX": 1, "sizeY": 1, "row": 0, "col": 0, content: '<div class="content">0</div>' },
] |
let panels: PanelModel[] = this.dashboardObject.panels;
while (i < panels.length) {
// Check panels using its id
if (this.dashboardObject.panels[i].id === "panel_0") {
// Update the panel data
panels[i] = [{ id: "panel_0", "sizeX": 1, "sizeY": 1, "row": 0, "col": 0, content: '<div class="content">01</div>' }]
break;
}
i++;
}
this.dashboardObject.panels = panels; |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.