zTree_v3
zTree_v3 copied to clipboard
Feature request, return Promise on reAsyncChildNodes call.
First of all, thanks for this greatest plugin! We use it for years on some internal projects and we have numbers of wrappers for zTree (depends on framework)
And for some reasons It would be good if zTreeObj.reAsyncChildNodes returned Promise object. In some cases it's not enough to have only onAsyncSuccess and onAsyncError callbacks.
At present, the architecture of zTree is rather stale, and it is not suitable for directly adding new syntax of ES6. I also want to rewrite, but now work is very busy, not too much time to make it, please forgive me.
But do you want to use 'Promise' in ES6 or 'Deferred' in Jquery? Your needs can only be handled separately.
Thank you for answer.
As for the Promises/Deferreds, I understand that some new features are not so easy to implement inside the current application architecture, I meant rather jQuery.Deferred than ES6-Promise (but es6 be very good 👍 ). It's just because I use ztree inside the ES6 application (with marionette.js v3.2 )
And also it would be good to have some method to setup async.otherParam (async query params) with some function of zTree Object, it be convenient. In my steps of using zTree I have filters to setup a content of project zTree (it's files in different formats and types), and each time I changed filter before calling reAsyncChildNodes I had to setup 'this.zTreeObj.setting.async.otherParam' directly from zTreeObj, to fill POST data request. I tried to use other navigation tree plugins, but each time I came back to zTree. It's amazing, simple and workable. I did't even think about some time zTree be re-wrote on ES6 syntax xD. But some minor features for ruling of requested of response data would be nice to have.
Thank you therefore.
I'm very busy in this week, I will do some change for your rule when I have free time.
I appreciate it, thank you very much!
please download the lastest code.
-
add function reAsyncChildNodesPromise(parentNode, reloadType, isSilent), to support ES6 Promise
-
modify: reAsyncChildNodes(parentNode, reloadType, isSilent, callback) ------ add param: callback
Looks good. Will try it next week. Thank you!