diff --git a/CHANGELOG.md b/CHANGELOG.md index af2bc9ad..e429ab9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * [BREAKING CHANGE] node.isStatusNode() is now a function (was a property before). Added new property `node.statusNodeType`. * [BREAKING CHANGE] Renamed ext-awesome to ext-glyph - * [DEPRECATION] Deprecated event `lazyLoad`, use `lazyLoad` (upper case L) instead. + * [DEPRECATION] Deprecated event `lazyload`, use `lazyLoad` (upper case L) instead. * [DEPRECATION] Deprecated methods node.lazyLoad() and node.discard(). use load() and resetLazy() instead. * [FEATURE] Added node.isUndefined(), isLoaded(), resetLazy(), load(), resetLazy() * [FEATURE] [ext-persist] Added option `expandLazy` for recursive loading (still experimental). diff --git a/demo/sample-ext-persist.html b/demo/sample-ext-persist.html index 5123a848..eaca4bd3 100644 --- a/demo/sample-ext-persist.html +++ b/demo/sample-ext-persist.html @@ -35,7 +35,7 @@ url: "ajax-tree-plain.json" }, persist: { - // expandLazy: true + expandLazy: true }, // don't use this in production code: ajax: { @@ -44,8 +44,24 @@ activate: function(event, data) { // alert("activate " + data.node); }, + // loadChildren: function(event, data) { + // data.node.debug("loadChildren", data); + // }, + postProcess: function(event, data) { + // Create predictable, **unique** keys, which we need for our lazy + // persistence example. This is only required for this demo, + // because our lazyLoad handler will allways return the same + // fake data. + var prefix = data.node.getIndexHier() + "."; + $.each(data.response, function(idx, childEntry){ + if( childEntry.key == null ) { + childEntry.key = prefix + (idx + 1); + childEntry.title += " (" + childEntry.key + ")"; + } + }) + }, lazyLoad: function(event, data) { - data.result = {url: "ajax-sub2.json"} + data.result = {url: "ajax-sub2.json"}; } }); var tree = $("#tree").fancytree("getTree"); diff --git a/src/jquery.fancytree.persist.js b/src/jquery.fancytree.persist.js index af57cc3d..266251ea 100644 --- a/src/jquery.fancytree.persist.js +++ b/src/jquery.fancytree.persist.js @@ -155,7 +155,7 @@ $.ui.fancytree._FancytreeClass.prototype.getPersistData = function(){ */ $.ui.fancytree.registerExtension({ name: "persist", - version: "0.1.0", + version: "0.2.0", // Default options for this extension. options: { // appendRequestInfo: false,