I am trying to have jstree open from root parent to selected child node. i am using jstree with mptt.
the template :
<div id="jstree" class="jstree">
<ul>
{% recursetree components %}
<li ><a href="/maintenance/{{node.id}}/update/">{{ node.name }}</a>
{% if not node.is_leaf_node %}
<ul id="child_node">
{{ children }}
</ul>
{% endif %}
</li>
{% endrecursetree %}
</ul>
</div>
the script :
<script>
$('#jstree').jstree().on('click', 'ul a', function () {
window.location = $(this).attr('href');
});;
$("#jstree").jstree("_open_to", 'child_node');
</script>