vakata/jstree — pull request #225 by smaknsk (2012-05-29 21:17:30+00:00)
Title: Fixed incorrect checkbox when the data is retrieved through Ajax

When the data is retrieved through Ajax, checkbox checked incorrect.

For example:

<script>
$(function(){
$('#demo1').jstree({
"plugins" : ['checkbox','themes', 'json'],
'json': {
'ajax': {
'url': '/jstree/get.php',
'data': function (n) {
return { id : n.attr ? n.attr("id") : 0 };
}
}
}
});
});
</script>

<div id="demo1" class="demo" style="min-height:100px;"></div>

<?php
echo json_encode(array(
array(
'li_attr' => array('id'=>'jstree_1'),
'title' => 'Node 1',
'children' => array(),
'data' => array(
'jstree' =>
array('checkbox' =>
array(
'name' => 'categoryIds[]',
'checked' => true,
'value' => "1",
)
)
)
),
array(
'li_attr' => array('id'=>'jstree_2'),
'title' => 'Node 2',
'data' => array(
'jstree' =>
array('checkbox' =>
array(
'name' => 'categoryIds[]',
'checked' => false,
'value' => "2",
)
)
)
)
));

Both node checked=true. But expected node 2 unchecked