dashboards icon indicating copy to clipboard operation
dashboards copied to clipboard

Gridstack: don't delete DOM nodes in destroy()

Open jhpedemonte opened this issue 9 years ago • 8 comments

https://github.com/troolee/gridstack.js/issues/238 https://github.com/troolee/gridstack.js/issues/216

Currently, Gridstack allows us to pass an option to remove_widget() so that the DOM node isn't removed from the container, but add_widget() and destroy() don't have those options.

In the meantime, we have created our own "subclass" of Gridstack which adds these options (code).

jhpedemonte avatar Sep 30 '15 18:09 jhpedemonte

Use make_widget to add a widget to gridstack without creating the DOM element.

kdietrich avatar Feb 12 '16 20:02 kdietrich

troolee/gridstack.js#264

parente avatar Feb 12 '16 20:02 parente

Using make_widget instead of add_widget will work, but there isn't yet a solution to destroy the Gridstack object without also destroying the DOM to which it is attached (see my comment here).

jhpedemonte avatar Feb 16 '16 22:02 jhpedemonte

OK. We'll keep tracking.

parente avatar Feb 17 '16 01:02 parente

Can't yet remove our destroy workaround. A different approach would be to disable Gridstack when we are not using it, then reuse existing Gridstack when going back to dashboard mode.

One issue is that this approach would complicate our code. For one, we would need to keep track of cells added in the Notebook mode. There were some other issues that I can't recall at the moment. That's why we went with the simpler implementation of destroying the Gridstack instance and recreating from scratch.

(Updated title to remove mention of add_widget)

jhpedemonte avatar Feb 17 '16 19:02 jhpedemonte

Opened PR #196 to track updating Gridstack to a version that doesn't require us to monkey patch destroy. However, I found there is still a bug when removing an individual cell -- see this discussion for more info.

jhpedemonte avatar Feb 24 '16 20:02 jhpedemonte

Gridstack cut an official 0.2.5. Some highlights (from quick perusal of commits):

Use with require.js

If you're using require.js and a single file jQueryUI please check out this Stackoverflow question to get it working properly.

jhpedemonte avatar Mar 03 '16 16:03 jhpedemonte

Grooming old issues ...

Gridstack 0.2.6 and up require jquery 3.1 and jquery-ui 1.12 (https://github.com/troolee/gridstack.js/releases/tag/v0.2.6). Notebook 5.0 is currently using to 2.0 and 1.10 respectively (https://github.com/jupyter/notebook/blob/5.0.0/bower.json#L12).

Trying to use gridstack 0.2.6 or 0.3.0 with what exists in notebook leads to undefined errors for the ui parameter in many gridstack callbacks, possibly caused by the version mismatch.

parente avatar Aug 06 '17 22:08 parente