Skip to content
Snippets Groups Projects
Commit ada1a4db authored by Max Lou's avatar Max Lou
Browse files

Adding widget refresh function

parent a67739d1
Branches
No related tags found
No related merge requests found
......@@ -106,10 +106,11 @@ function removeAllChildNodes(parent) {
/**
* Initial widgets grid
* @param {*} widgets
* @param {*} initialWidgets
* @param {*} items
*/
export function initGrid(widgets, items) {
export function initGrid(initialWidgets, items) {
let widgets = initialWidgets
// Basic grid object
const grid = GridStack.init({
cellHeight: 70,
......@@ -270,6 +271,15 @@ export function initGrid(widgets, items) {
disableWidgetMoveAndResize();
}
/**
* Refresh widgets with updated widgets array.
* @param {*} newWidgets
*/
function refreshWidgets(newWidgets) {
widgets = newWidgets
plotWidgets(grid.engine.nodes, widgets);
}
return {
grid,
toggleSidebar,
......@@ -277,5 +287,6 @@ export function initGrid(widgets, items) {
load,
enableWidgetMoveAndResize,
disableWidgetMoveAndResize,
refreshWidgets
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment