Skip to content

Commit

Permalink
[ext-persist] Added sample for recursive loading of lazy structures
Browse files Browse the repository at this point in the history
Closed #150
  • Loading branch information
mar10 committed Mar 9, 2014
1 parent 169db38 commit 00a226a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
20 changes: 18 additions & 2 deletions demo/sample-ext-persist.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
url: "ajax-tree-plain.json"
},
persist: {
// expandLazy: true
expandLazy: true
},
// don't use this in production code:
ajax: {
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/jquery.fancytree.persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 00a226a

Please sign in to comment.