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

Uncaught TypeError: Cannot read property 'id' of null using qubit with bonsai #2

Open
combatdave opened this issue Aug 6, 2014 · 2 comments

Comments

@combatdave
Copy link

I am using the following example code with latest qubit and bonsai. I am getting "Uncaught TypeError: Cannot read property 'id' of null" when checking or unchecking a leaf or child node, and "Uncaught TypeError: Cannot read property 'prop' of null" when checking a child node.

<body>
    <ol id='auto-checkboxes' data-name='foo'>
        <li class='expanded' data-value='0'>All
            <ol>
                <li data-value='1'>One</li>
                <li data-value='2'>
                    Two
                    <ol>
                        <li data-name='baz' data-value='3'>
                            Three
                            <ol>
                                <li data-name='baz' data-value='4' data-checked='0'>Four</li>
                            </ol>
                        </li>
                        <li data-value='5'>Five</li>
                    </ol>
                </li>
            </ol>
        </li>
    </ol>

    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="bonsai/jquery.qubit.js"></script>
    <script type="text/javascript" src="bonsai/jquery.bonsai.js"></script>
    <script type="text/javascript">

        $('#auto-checkboxes').bonsai({
            expandAll: true,
            checkboxes: true, // depends on jquery.qubit plugin
            createCheckboxes: true // takes values from data-name and data-value, and data-name is inherited
        });

    </script>
</body>
@PatrickRose
Copy link

This seems to be a bug in the getValue method. I've fixed it locally by adding a check for the checkbox being null. I also added this to the setCheckedMethod()

I'll submit a pull request shortly

@simonexmachina
Copy link
Owner

Thanks for responding @PatrickRose! @combatdave I've created a JSBin with your code and this isn't happening for me. Can you try to reproduce it on JSBin so I can see your issue?

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

3 participants