-
-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
toDict() for lazy folder without childrens should add children with empty array instead of no adding them at all. #989
Comments
I would think that this is the expected behavior: Closing this for now. but let me now if you have reasons for a different use case. |
I still think it isn't expected behavior (and maybe it was not clear it according to your answer: it is a case when folder is lazy:true but it don't have children), because:
Copying not empty folder creates copy with 'not expanded state'. |
So your case is
? |
After some more testing, looks like there are two bugs or 1st bug causes second:
//Tested on my page:
Fixing idea:
Enchanting www 1.: On website with code source code www ::marker with number of lines needs some more space (or on mouse over tooltip with number), as four digit numbers are partially hidden. |
I agree that I think this also fixes your problem; can you confirm? Some remarks though
Anyway: thank you for taking the time to find and describe your findings! |
Ad 1. And it shouldn't. My trouble with toDict is similar to this with children array, its removes all undefined keywords from node and some of them (like expanded state) should stay anyway, even with undefined status. It would be nice if it allow to pass array of strings with keywords.
Suggested change to example:
With working callback adding if(!!!dict.children) dict.children = []; fixed my issue, so yours change should also did it. Ad. 3. I knew it, just marked it as possible place for error (and missed with that call). Ad. 4. Yes, it can be an issue, but it is fixable in server side ajax script, just returned json for empty folder should have children: [] and not children: null or children: false. EDITED: Tip added to wiki. |
The demo was missing the first parameter, but it should be I fixed the demos, but still don't understand why you need to manually copy |
Ad 1. Yes, it should be true, i forgot to change in post after finding that error it in my code. For toDict nice and easy addition may be whitelist.
It will create easy way to extract custom data from node and its children, without need to cut lot data in callback function as it is now. |
Test in modified: https://wwwendt.de/tech/fancytree/demo/index.html#sample-multi-ext.html
ISSUE:
1.: Copied to CLIPBOARD lazy folder without children:
data: {…} data: Object { id: "68" } expanded: false folder: true key: "_5" lazy: true partsel: false selected: false title: "fff" type: "folder <prototype>: Object { … } mode: "copy" <prototype>: Object { … }
2.: Paste node from CLIPBOARD.
3.: Pasted folder arrives as expandable, as children != empty array means not loaded yet.
Issue fix ideas:
in lib: function toDict() adds to returned object "children: [],", if there is "lazy: true" option on.
in code that uses lib: echo '[]' from lazyLoad ajax or check in lazyLoad: function(event, data) { ... } for children calling it folder.
The text was updated successfully, but these errors were encountered: