javascript - None of the jstree plugins are functioning -
this frustrating problem, 1 cannot seem find documentation for. i'm relatively new jquery (although grasp on developing), , new jstree plugin.
the problem cannot of plugins work. attracted because of drag , drop, context menu, , checkbox functionality, aren't happening. not getting errors, i'm getting no check boxes , default chrome context menu. , can't drag , drop anything.
the jstree populates using ajax:
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>jstree test</title> <link rel="stylesheet" href="styles/style.min.css" /> <script src="scripts/jquery-2.1.4.min.js"></script> <script src="scripts/jstree.min.js"></script> <script> $(document).ready(function () { $('#jstreetest').jstree({ 'core': { 'check_callback' : true, 'data': { 'url': 'temp/ajax.html', 'data': function (node) { return { 'id': node.id }; } } }, 'plugins' : [ "checkbox", "dnd", "contextmenu"] }); }); </script>
and mark looks so:
<body> <form id="form1" runat="server"> <div> <div id="jstreetest"> </div> </div> </form> </body>
the html file ajax.html contains following:
<ul> <li>test <ul> <li>subdir1 <ul> <li><a href='#'>file1.txt</a></li> </ul> </li> <li>subdir2 <ul> <li>subsubdir1 <ul> <li><a href='#'>file1.txt</a></li> <li><a href='#'>file2.txt</a></li> </ul> <li><a href='#'>file2.txt</a></li> <li><a href='#'>file3.txt</a></li> </ul></li> <li><a href='#'>file4.txt</a></li> <li><a href='#'>file5.txt</a></li> </ul> </li> </ul>
as aside, it's showing folder icon next it, thing don't understand. missing reference??
make sure include css
file vastly change way things jstree plugin.
$(document).ready(function () { $('#jstreetest').jstree({ 'core': { 'check_callback' : true, }, 'plugins' : [ "checkbox", "dnd", "contextmenu"] }); });
<link href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.1.1/themes/default/style.min.css" rel="stylesheet"/> <link href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.1.1/themes/default-dark/style.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.1.1/jstree.min.js"></script> <body> <form id="form1" runat="server"> <div> <div id="jstreetest"> <ul> <li>test <ul> <li>subdir1 <ul> <li><a href='#'>file1.txt</a></li> </ul> </li> <li>subdir2 <ul> <li>subsubdir1 <ul> <li><a href='#'>file1.txt</a></li> <li><a href='#'>file2.txt</a></li> </ul> <li><a href='#'>file2.txt</a></li> <li><a href='#'>file3.txt</a></li> </ul></li> <li><a href='#'>file4.txt</a></li> <li><a href='#'>file5.txt</a></li> </ul> </li> </ul> </div> </div> </form> </body>
Comments
Post a Comment