Loaded and Ready events not firing for me, JSTree_3.0.0

974 views
Skip to first unread message

chris....@cpasitesolutions.com

unread,
May 5, 2015, 11:06:10 AM5/5/15
to jst...@googlegroups.com

Hi,

My JSTree used to select and expand a node correctly right after the tree was fully loaded using the source code below but recently stopped working. I guess something I changed elsewhere broke this.  Does anyone see anything wrong with the .on("loaded.jstree"?   I've also tried ready.jstree without success.  The "@Model.SelectedTreeNodeId" is putting the correct node id value.  This code is using JSTree-3.0.0 as per image showing includes




<div id="fvNavTree" class="demo">
</div>


<script type="text/javascript" class="source below">
	$(document).ready(function ()
	{
		$("#fvNavTree")
			.jstree({
				"plugins": ["sort""ui""core""wholerow"],   //, "html_data", "themes"
				"ui": { "selected_parent_open"true"initially_select": ["@Model.SelectedTreeNodeId"] },
				"core": {
					"initially_open": ["@Model.SelectedTreeNodeId"],
					"themes": {
						"dots"false,
						"responsive"false
					},
					"animation": 125
				}
			})
		.on("loaded.jstree"function (e, data)
			{
				$('#fvNavTree').jstree("select_node"'@Model.SelectedTreeNodeId', true);
				// alert("Made it here")
}); }); </script>

Ivan Bozhanov

unread,
May 5, 2015, 4:49:46 PM5/5/15
to jst...@googlegroups.com
Try attaching the event before creating the tree:
$('#tree').on('ready.jstree', function () { ...  }).jstree(...);

Also make sure you are using the latest version, there have been a lot of fixes since 3.0.0.

Best regards,
Ivan

chris....@cpasitesolutions.com

unread,
May 7, 2015, 10:22:17 AM5/7/15
to jst...@googlegroups.com

Thanks Ivan, setting up the .on event for the tree before creating the tree solved this binding issue.  You rock.
Reply all
Reply to author
Forward
0 new messages