1

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.

Aasim Hussain Khan
  • 1,137
  • 3
  • 15
  • 33

1 Answers1

4

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!!!

yoku2010
  • 600
  • 1
  • 4
  • 14
  • Thanks alot Yogesh.:) This is exactly what I wanted. Currently we have 0,1, 2 etc in the boxes. Can we add some text instead of numbers. – Aasim Hussain Khan Sep 03 '14 at 06:34
  • 1
    Yes you can. I have change that code according to your requirement . please check that demo again. now you can add "text" property to define text within "li". if you don't define that property, it will remain empty. – yoku2010 Sep 03 '14 at 07:14
  • Hey Yogesh, I have one more issue related to gridster. Can you please check out this link http://stackoverflow.com/questions/25639081/get-text-in-gridster-serialize-data-as-json – Aasim Hussain Khan Sep 03 '14 at 08:12