Search code examples
jqueryjsongridster

Build gridster layout using serialize data (JSON) as input


I want to build gridster box layout using JSON as input.

In [http://gridster.net/demos/serialize.html] we get JSON data when we click on serialize. Now how do I build the layout using this JSON as input. Like I want the reverse of serialize, making layout using JSON.

Please help. Thanks in advance.


Solution

  • Please check Demo link

    Demo

    I have created a JS plugin to achieve this.

    Calling of the plugin is like this

    $('#gridster').makeGridster({
        jsonArr:[],   // Please define your json Array here
        widget_base_dimensions: [100, 55],
        widget_margins: [5, 5]
    });
    

    From now you have to call makeGrister function instead of gridster. I have added only one property jsonArr other properties are remain same.

    Thanks!!!