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

Admin treetable not working for me #15

Closed
phoebebright opened this issue Mar 7, 2011 · 4 comments
Closed

Admin treetable not working for me #15

phoebebright opened this issue Mar 7, 2011 · 4 comments

Comments

@phoebebright
Copy link

Not sure if this is a versions problem. I get this error when loading admin page for Categories:

TypeError: Result of expression '$' [undefined] is not an object.
On this line in treeTable.js
$.fn.treeTable = function(opts) {

treeTable v 2.3.0
jQuery v. 1.4.2

@coordt
Copy link
Contributor

coordt commented Mar 7, 2011

It appears that jQuery is loaded. It is included in Django 1.2 and is specifically loaded in the admin/editor/tree_editor.html template. is 'editor' in your installed apps?

@phoebebright
Copy link
Author

Yes I have editor in apps.

This is the top of the page that lists the categories:

<script type="text/javascript" src="/media/js/core.js"></script> <script type="text/javascript" src="/media/js/admin/RelatedObjectLookups.js"></script> <script type="text/javascript" src="/media/js/jquery.min.js"></script> <script type="text/javascript" src="/media/js/jquery.init.js"></script> <script type="text/javascript" src="/media/js/actions.min.js"></script> <script type="text/javascript" src="/media/js/urlify.js"></script> <script type="text/javascript" src="/media/js/prepopulate.min.js"></script> <script type="text/javascript" src="/site_media/editor/jquery.treeTable.js"></script> <script type="text/javascript" src="/site_media/js/genericcollections.js"></script> <script type="text/javascript"> (function($) { $(document).ready(function($) { $("tr input.action-select").actions(); }); })(django.jQuery); </script>
<script type="text/javascript">
(function($) {
    $(document).ready(function()  {
    //treeTable = $("#result_list").treeTable({initialState : "expanded"});
    treeTable = $("#result_list").treeTable({initialState : "collapsed"});
    function toggleChildren() {
        this.checked = event.currentTarget.checked;
        var row = this.parentNode.parentNode.parentNode;
        if($(row).hasClass("parent")) {
            $("table.treeTable tbody tr.child-of-" + row.id + " input").each(toggleChildren);
        }
        $("tr input.action-select").actions();
    };
    $('.action-select').each(
        function(){
            $(this).bind('click', function(event){
                // Get the tr from checkbox -> a -> td -> tr
                var row = event.currentTarget.parentNode.parentNode.parentNode;
                $("table.treeTable tbody tr.child-of-" + row.id + " input").each(toggleChildren);
            });
        });
    });
})(django.jQuery);
</script>

1 similar comment
@phoebebright
Copy link
Author

Yes I have editor in apps.

This is the top of the page that lists the categories:

<script type="text/javascript" src="/media/js/core.js"></script> <script type="text/javascript" src="/media/js/admin/RelatedObjectLookups.js"></script> <script type="text/javascript" src="/media/js/jquery.min.js"></script> <script type="text/javascript" src="/media/js/jquery.init.js"></script> <script type="text/javascript" src="/media/js/actions.min.js"></script> <script type="text/javascript" src="/media/js/urlify.js"></script> <script type="text/javascript" src="/media/js/prepopulate.min.js"></script> <script type="text/javascript" src="/site_media/editor/jquery.treeTable.js"></script> <script type="text/javascript" src="/site_media/js/genericcollections.js"></script> <script type="text/javascript"> (function($) { $(document).ready(function($) { $("tr input.action-select").actions(); }); })(django.jQuery); </script>
<script type="text/javascript">
(function($) {
    $(document).ready(function()  {
    //treeTable = $("#result_list").treeTable({initialState : "expanded"});
    treeTable = $("#result_list").treeTable({initialState : "collapsed"});
    function toggleChildren() {
        this.checked = event.currentTarget.checked;
        var row = this.parentNode.parentNode.parentNode;
        if($(row).hasClass("parent")) {
            $("table.treeTable tbody tr.child-of-" + row.id + " input").each(toggleChildren);
        }
        $("tr input.action-select").actions();
    };
    $('.action-select').each(
        function(){
            $(this).bind('click', function(event){
                // Get the tr from checkbox -> a -> td -> tr
                var row = event.currentTarget.parentNode.parentNode.parentNode;
                $("table.treeTable tbody tr.child-of-" + row.id + " input").each(toggleChildren);
            });
        });
    });
})(django.jQuery);
</script>

@heymarkreeves
Copy link

I'm seeing something similar presently - All the UI files are loading properly, but I'm not seeing .treeTable as a class on the table. I see child rows in the source, but I do not see them in the admin UI, and there's no toggle to expand/collapse them.

See: #79

This issue was closed.
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