尝试重新启动gridster dynamically
,但似乎gridster draggble
在销毁并重新创建后无法正常工作。看看我的代码。
var gridster;
function initGridster() {
gridster = $(".gridster").gridster({
widget_margins: [5, 5],
widget_base_dimensions: [500, 300],
autogrow_cols: true,
max_cols: 2,
shift_widgets_up: false,
shift_larger_widgets_down: false,
collision: {
wait_for_mouseup: true
},
draggable: {
stop: function (e, ui) {
var id = this.placeholder_grid_data.el[0].id;
var positions = this.player_grid_data;
var data = { widgetId: id, position: positions };
}
}
}).data('gridster');
}
initGridster(); //First time init gridster
gridster.destroy(); //destorying
initGridster(); // Re initiating , but draggable doesn't work anymore