jquery-qubit icon indicating copy to clipboard operation
jquery-qubit copied to clipboard

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

Open combatdave opened this issue 11 years ago • 2 comments

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>

combatdave avatar Aug 06 '14 14:08 combatdave

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

PatrickRose avatar Aug 08 '14 12:08 PatrickRose

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?

simonexmachina avatar Aug 10 '14 23:08 simonexmachina