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

Selected nodes incorrectly persisted in multi-hier tree #354

Closed
ghost opened this issue Nov 14, 2014 · 2 comments
Closed

Selected nodes incorrectly persisted in multi-hier tree #354

ghost opened this issue Nov 14, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 14, 2014

Using fancytree 2.3.0, jquery 1.11.1, jquery-ui 1.11.2, and jquery-cookie 1.4.1.

In a multi-hier tree selections are incorrectly persisted by the persist extension. This behaviour appears to work correctly in dynatree 1.2.6.

If a parent node is selected all child nodes are selected. The <prefix>-selected cookie contains the parent's ID.

Issue 1: If the page is reloaded the parent node is correctly selected but the child nodes are not.

Issue 2: If a child node is deselected the parent shows partial selection. If the page is reloaded the parent shows normal selection and all child nodes are not selected.

The following code recreates the issue:

<html>
  <head>
    <title>Fancytree Test</title>
    <link rel="stylesheet" type="text/css" href="lib/jquery-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="lib/skin-vista/ui.fancytree.min.css"/>
    <script type="text/javascript" src="lib/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="lib/jquery-ui.min.js"></script>
    <script type="text/javascript" src="lib/jquery.cookie.js"></script>
    <script type="text/javascript" src="lib/jquery.fancytree-all.js"></script>
    <script type="text/javascript">
        function load() {
            $('#fancytree').fancytree({
                checkbox: true,
                selectMode: 3,
                source: [{title: 'parent', expanded: true, children: [{title: 'child 1'}, {title: 'child 2'}]}],
                extensions: ['persist'],
                persist: {
                    cookiePrefix: 'prefix-',
                    store: 'cookie',
                    overrideSource: true,
                    cookie: {
                        expires: 1
                    }
                }
            });
        }
    </script>
  </head>
  <body onload="load()">
    <div id="fancytree"></div>
  </body>
</html>
@ghost
Copy link
Author

ghost commented Nov 15, 2014

I was able to correct issue 1 by uncommenting line 6360 in jquery.fancytree.all.js and commenting line 6361 but this did not affect issue 2.

@mar10 mar10 closed this as completed in 194a701 Nov 16, 2014
@ghost
Copy link
Author

ghost commented Nov 17, 2014

Wow that was fast. Keen to try out the fix - thanks!

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

No branches or pull requests

0 participants