Revert treeList children function signature change

This commit is contained in:
Nick O'Leary 2019-05-27 21:11:50 +01:00
parent 423aba5bab
commit 390b86cd8e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 6 additions and 6 deletions

View File

@ -655,7 +655,7 @@ RED.clipboard = (function() {
// icon: 'fa fa-hdd-o', // icon: 'fa fa-hdd-o',
// label: RED._("library.types.examples"), // label: RED._("library.types.examples"),
// path: "", // path: "",
// children: function(item,done) { // children: function(done,item) {
// RED.library.loadLibraryFolder("_examples_","flows","",function(children) { // RED.library.loadLibraryFolder("_examples_","flows","",function(children) {
// item.children = children; // item.children = children;
// done(children); // done(children);
@ -670,7 +670,7 @@ RED.clipboard = (function() {
label: label, label: label,
path: "", path: "",
expanded: true, expanded: true,
children: function(item,done) { children: function(done, item) {
RED.library.loadLibraryFolder(library,"flows","",function(children) { RED.library.loadLibraryFolder(library,"flows","",function(children) {
item.children = children; item.children = children;
done(children); done(children);

View File

@ -34,7 +34,7 @@
* label: 'Local', // label for the item * label: 'Local', // label for the item
* icon: 'fa fa-rocket', // (optional) icon for the item * icon: 'fa fa-rocket', // (optional) icon for the item
* selected: true/false, // (optional) if present, display checkbox accordingly * selected: true/false, // (optional) if present, display checkbox accordingly
* children: [] | function(item,done) // (optional) an array of child items, or a function * children: [] | function(done,item) // (optional) an array of child items, or a function
* // that will call the `done` callback with an array * // that will call the `done` callback with an array
* // of child items * // of child items
* } * }
@ -236,7 +236,7 @@
var childrenAdded = false; var childrenAdded = false;
var spinner; var spinner;
var startTime = 0; var startTime = 0;
item.children(item,function(children) { item.children(function(children) {
childrenAdded = true; childrenAdded = true;
item.treeList.childList = that._addChildren(container,item,children,depth).hide(); item.treeList.childList = that._addChildren(container,item,children,depth).hide();
var delta = Date.now() - startTime; var delta = Date.now() - startTime;
@ -255,7 +255,7 @@
} }
done && done(); done && done();
that._trigger("childrenloaded",null,item) that._trigger("childrenloaded",null,item)
}); },item);
if (!childrenAdded) { if (!childrenAdded) {
startTime = Date.now(); startTime = Date.now();
spinner = $('<div class="red-ui-treeList-spinner">').css({ spinner = $('<div class="red-ui-treeList-spinner">').css({

View File

@ -133,7 +133,7 @@ RED.library = (function() {
icon: 'fa fa-folder', icon: 'fa fa-folder',
label: d, label: d,
path: root+d+"/", path: root+d+"/",
children: function(item,done) { children: function(done, item) {
loadLibraryFolder(library,type,root+d+"/", function(children) { loadLibraryFolder(library,type,root+d+"/", function(children) {
item.children = children; // TODO: should this be done by treeList for us item.children = children; // TODO: should this be done by treeList for us
done(children); done(children);