ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.04k stars 1.2k forks source link

How to initialize gridster ? #504

Open harshmsp opened 9 years ago

harshmsp commented 9 years ago

Hello All, I need to bind gridster list dynamically. Means there are list of template and I am binding through gridster ul with below statements. var cTemplateHtml = (List of all Li with data-row,data-column and data-sizex,data-sizey field $('.gridster >ul').html(cTemplateHtml);

Now I just want to confirm as if user select another template then first I need to remove all widgets or if I am remove gridster html with '' then it works ?

Please help

bondt commented 9 years ago

Have you tried using the follwing to destroy the old gridster, set a new one and get its handle?

$('.gridster >ul').data("gridster").destroy(); // destroy
var newGridster = $('.gridster >ul').html(newTemplateHtml).gridster().data("gridster"); // re-create