I have a jstree with the checkbox plugin that I load with JSON data using AJAX. When an event happens in my page, I want to cause the tree to reload and use the selected state that is returned from the AJAX call.
I create my tree as:
$('#jstree').jstree({
"checkbox": {
"keep_selected_style": false
},
'core': {
'data': {
'url': function () { return '/home/GetLayerTreeViewData' },
'data': function (node) {
return { 'id':
node.id };
}
}
},
"plugins": ["checkbox", "json_data"]
});
When my event occurs, I refresh the using:
("#jstree").jstree(true).refresh();
My new nodes appear so I know the tree is refreshing and reading the JSON data. I can't get them to appear in an initially checked state however. They will appear selected if I return state selected as true when the tree initially loads, but it seems to be ignored on subsequent loads. I want the tree to ignore whatever state it has and just reload the returned data. Is there some setting I'm missing or some other parameter I need to pass?