@hairyheron
hi,
how to i can export current position as JSON format, then show by this json.
I am not a maintainer of this project. Even if I were, I do not understand your question.
If you want to persist layout of gridstack on the page, here is a short example:
var getGridJSON = function () {
var nodes = $('#gridstack').data('gridstack').grid.nodes;
return nodes.map(function(obj, idx){
return {
x: obj.x,
y: obj.y,
width: obj.width,
height: obj.height,
minHeight: obj.minHeight,
minWidth: obj.minWidth
}
});
};
// this will give you array with each gridstack item, stringify it and persist in the backend :)
console.log(getGridJSON());
Thanks, @zhanazhan . That looks like a good solution.
Most helpful comment
If you want to persist layout of gridstack on the page, here is a short example: