You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to define sub-grid in HTML and initialize it later in JS #2554
you can't init nested by dom attr. my focus has been dynamic grids (since they need to read/write them) using API options eg: https://gridstackjs.com/demo/nested.html, not dom values (which doesn't support all options anyway). see slack channel, someone also was trying...
@adumesny I am on Slack, but can't find anything similar using the search...
Is it possible to initialize GridStack using API and content from HTML? I am looking for something like:
let grid=GridStack:init(options,myMainGridElement)letitems=document.queryElementsByClass('grid-stack-item')for(letitemofitems){grid.makeWidget(item)}letsubgrids=document.queryElementsByClass('grid-stack-nested')for(letsubgridofsubgrids){grid.makeSubGrid(subgird,suboptions)}
The use case is to render components using Vue.js and then initialize GridStack on top of it using DOM attributes or JS API.
Activity
adumesny commentedon Nov 28, 2023
you can't init nested by dom attr. my focus has been dynamic grids (since they need to read/write them) using API options eg: https://gridstackjs.com/demo/nested.html, not dom values (which doesn't support all options anyway). see slack channel, someone also was trying...
vmihailenco commentedon Nov 29, 2023
@adumesny I am on Slack, but can't find anything similar using the search...
Is it possible to initialize GridStack using API and content from HTML? I am looking for something like:
The use case is to render components using Vue.js and then initialize GridStack on top of it using DOM attributes or JS API.
vmihailenco commentedon Nov 29, 2023
This almost works, but the positioning and sizing is off: https://jsfiddle.net/kznc3vr7/2/
adumesny commentedon Mar 30, 2024
if you want to donate for this feature (init nested from DOM) it could be added, but frankly not of my radar...
Update: I fixed your example, which should work but again if I doesn't I would need to get donation to look into it as DOM is not my focus.
carvinlo commentedon Jul 30, 2024
This functional requirement greatly improves the flexibility of nested layout!