I'm using JsTree 1.0 and having trouble pre-checking checkboxes using the checkbox plugin.
Here's my full code:
 $(".tree").bind("loaded.jstree", function (event, data) {
                 $('.tree li.checked').each(function () {
                     $(this).prop("checked", true);
                })
            }).jstree({ 
                "core" : { "animation" : 0}, 
                "json_data" : {
                    "ajax" : {
                        "url" : "/admin/posts/get_taxonomy_tree",
                        "data" : function (n) { 
                            return { id : n.attr ? n.attr("id") : 0 }; 
                        }
                    },
                    "progressive_render" : true
                },
                "checkbox" : {
                    "real_checkboxes" : true,
                    "real_checkboxes_names" : function(n){
                        return [("term_taxonomy_id_" + (n[0].id || Math.ceil(Math.random() * 10000))), 1]; 
                    }
                    },
                "themes" : {
                    "url"   :   "/assets/admin/js/jstree/themes/default/style.css",
                    "icons": false
                },
                "plugins" : [ "themes",开发者_开发问答 "json_data", "checkbox" ]
            }).delegate("a", "click", function (event, data) { event.preventDefault(); });
I've added the bind event for loading.jstree, but this isn't correct - doesn't work.
Any ideas? Thank you!
EDIT:
Solution is to add the class jstree-checked, this will by default pre-check the box
Solution is to add the class 'jstree-checked', this will by default pre-check the box
Make sure to add the "checked" class because it used to pre-check boxes on load =)
The following code may resolve your issue.
$('.tree').jstree("check_all");
 
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论