lavkach3
1$(function () {2// Nestable3var updateOutput = function (e) {4var list = e.length ? e : $(e.target),5output = list.data("output");6if (window.JSON) {7output.val(window.JSON.stringify(list.nestable("serialize"))); //, null, 2));8} else {9output.val("JSON browser support required for this demo.");10}11};12
13$("#nestable")14.nestable({15group: 1,16})17.on("change", updateOutput);18
19$("#nestable2")20.nestable({21group: 1,22})23.on("change", updateOutput);24
25updateOutput($("#nestable").data("output", $("#nestable-output")));26updateOutput($("#nestable2").data("output", $("#nestable2-output")));27
28$("#nestable-menu").on("click", function (e) {29var target = $(e.target),30action = target.data("action");31if (action === "expand-all") {32$(".dd").nestable("expandAll");33}34if (action === "collapse-all") {35$(".dd").nestable("collapseAll");36}37});38
39$("#nestable-menu").nestable();40});41