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

Problem with 'collapse all' example #105

Closed
funlovin opened this issue Dec 4, 2013 · 7 comments
Closed

Problem with 'collapse all' example #105

funlovin opened this issue Dec 4, 2013 · 7 comments
Labels
Milestone

Comments

@funlovin
Copy link

funlovin commented Dec 4, 2013

Hi,

I tried to use this example
$("#tree").fancytree("getRootNode").visit(function(node){
node.setExpanded(false);
});

But I get an error inside the function nodeRender [ (_assert(isRootNode || parent.ul, "parent UL must exist") ].
But the tree looks good.

When I use this for 'collapse all'
$("#tree").fancytree("getRootNode").visit(function(node){
node.setExpanded(true);
node.setExpanded(false);
});
there is no error. But the tree expand completely and then collapse, which doesn't look good.

Any idea?

Thanks a lot!

@mar10
Copy link
Owner

mar10 commented Dec 5, 2013

does [Expand All] work for you on the sample page?
http://wwwendt.de/tech/fancytree/demo/sample-api.html
Could you send a sample that reproduces the problem?

@funlovin
Copy link
Author

funlovin commented Dec 5, 2013

[Expand All] and [Collapse All] work perfect for me on your example page.
When I use your example tree in my code, then everything works fine, too.

This is my example

<ul id="ROOT_System" style="display: none;">
  <li class="expanded" icon="/subsite/Custom/images/document_tree.png">
    <a href="/Lists/RootNavigation/DispF.aspx?ID=1" target="_self" title="">Global</a>
    <ul>
      <li class="expanded folder" icon="/subsite/Custom/images/gear_in.png">
        <span>[Title]</span>
        <ul>
            <li class="expanded folder" icon="/subsite/Custom/images/folder.png">
                <span counter="true">Equipment</span>
                  <ul>
                      <li listGuid="Guids.Equipment" orderBy="Title" connection="preSystemID:preSystemID" icon="/subsite/Custom/images/gear_in.png">
                        <span>[Title]</span>
                        <ul>
                            <li class="folder expanded" icon="/subsite/Custom/images/folder.png" >
                            <span counter="true">Subequipment</span>
                                <ul>
                                  <li listGuid="Guids.SubEquipment" orderBy="Title" connection="preSystemID:preSystemID;preEquipmentID:preEquipmentID" icon="/subsite/Custom/images/gear_in.png"><span>[Title]</span></li>
                                </ul>
                            </li>
                        </ul>
                      </li>
                  </ul>
            </li>
            <li id="id1.2" class="expanded folder" icon="/subsite/Custom/images/folder.png">
                <span counter="true">Ships with same System</span>
                  <ul>
                      <li listGuid="{7844bc13-34f7-46f2-aabf-65276df9239f}" orderBy="Title" connection="preSystemID:preSystemID" icon="/subsite/Custom/images/schiff.png">
                        <span>[Title]</span>
                        <ul>
                            <li class="folder" icon="/subsite/Custom/images/folder_blue.png">
                                <span counter="true">Ship Documents</span>
                                  <ul>
                                      <li listGuid="{081aefd0-4410-46d9-bf1d-c79c025597f0}" orderBy="Title" connection="preSystemID:preSystemID;preSchiffID:preSchiffID" icon="/subsite/Custom/images/folder_document.png">
                                        <span>[Title] ([preTaxKeyword])</span>
                                      </li>
                                  </ul>
                            </li>                   
                        </ul>
                      </li>
                  </ul>
            </li>
          </ul>
        </li>
      </ul>
    </li>
</ul>

I also tried it without the [span] tags, but without success.

@mar10
Copy link
Owner

mar10 commented Dec 5, 2013

I could reproduce this.

@funlovin
Copy link
Author

funlovin commented Dec 5, 2013

Something wrong with my tree?

@mar10
Copy link
Owner

mar10 commented Dec 6, 2013

no, but the collpase loop has a problem, whe a node was not yet rendered.
as a workaround, you could try to skip collapsed nodes
something like (not tested):

$("#tree").fancytree("getRootNode").visit(function(node){
    if( !node.isExpanded() ) {
        return false;
    }
    node.setExpanded(false);
});

@mar10 mar10 closed this as completed in 756d47e Dec 7, 2013
@mar10 mar10 added this to the 2.0.0beta milestone May 11, 2014
@q640202047
Copy link

i have some problem,so sad

@mar10
Copy link
Owner

mar10 commented Jun 8, 2017

This issue was fixed 3 years ago.
Please open a new one, describing the exact problem and give a sample how it can be reproduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants