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

SVG font awesome 5 glyphs remove badge counter when parent node is collapsed. #918

Closed
sophanox opened this issue Dec 11, 2018 · 2 comments
Closed

Comments

@sophanox
Copy link

#839

With reference to the above (and this demo example: http://wwwendt.de/tech/fancytree/demo/#sample-ext-glyph-svg.html), I had an issue whereby the childcounter badges were being removed when the parent node was collapsed. When the parent node was re-expanded, any child nodes with badges were recreated without the badges. I believe this is because the call to replace the icon HTML with the svg element removed any badge, and the call to add the badge wasn't made until the node was reactivated.

To fix this, I have had to add the following to the glyph extension file at line 294:

            if (node.folder === true) {
                var newSpan = document.createElement('span');
                newSpan.className = 'fancytree-childcounter';
                newSpan.innerText = node.data.FilesUnderneathFolder;
                span.appendChild(newSpan);
            }

This ensures the badge counter is properly rendered each time.

Hope this helps!

@sophanox sophanox changed the title SVG font awesome 5 glyphs remove bade counter when parent node is collapsed. SVG font awesome 5 glyphs remove badge counter when parent node is collapsed. Dec 11, 2018
@silviagreen
Copy link

silviagreen commented Mar 7, 2019

Corrected in my case changing the code of glyph extension at line 174:

from

span.innerHTML = "";

to

var counter = $span.find('.fancytree-childcounter');
span.innerHTML = "";
$span.append(counter);

@mar10 mar10 added the patch label Mar 10, 2019
@mar10 mar10 closed this as completed in 52dcc50 Mar 10, 2019
@mar10
Copy link
Owner

mar10 commented Mar 10, 2019

Thanks (is Pls. let me know if it works for you)

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

3 participants