Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazyLoad with promise not calling postProcess #983

Closed
beaver71 opened this issue Dec 30, 2019 · 0 comments
Closed

lazyLoad with promise not calling postProcess #983

beaver71 opened this issue Dec 30, 2019 · 0 comments

Comments

@beaver71
Copy link

beaver71 commented Dec 30, 2019

I'm trying to lazyloading children nodes following this tutorial:

https://github.com/mar10/fancytree/wiki/TutorialLoadData#use-a-deferred-promise

I've tried both with $.Deferred() and ES6 Promise, but when promise is resolved no postProcess function is called.
Instead using Ajax requests the behaviour is correct.

Here are examples of my code:

lazyLoad: function(event, data) {
	var path = data.node.data.path;
	// 1) Ajax is working correctly
	data.result = {
		url: "/api/listDirsRec?path="+path,
	}; 
	// 2) $.Deferred not working
	var defer = new $.Deferred();
	data.result = defer.promise();
	files.listDirsRec(path, function(resp) {
		defer.resolve(resp);
	});
	// 3) ES6 Promise not working
	data.result = new Promise(function(resolve, reject) {
		files.listDirsRec(path, function(resp) {
			resolve(resp);
		});
	});
},
postProcess: function(event, data) {
	// never called after lazy load
},
@beaver71 beaver71 closed this as completed Jan 2, 2020
@beaver71 beaver71 reopened this Jan 2, 2020
mar10 added a commit that referenced this issue Jan 3, 2020
@mar10 mar10 closed this as completed in d6abf0d Jan 3, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants