gijgo
gijgo copied to clipboard
How can i bind my data to tree view?
** $(document).ready(function(){ $('#results').change(function(){
var id = $(this).val();
$.ajax({
url: 'treeView/'+id,
type: 'get',
dataType: 'json',
success: function(response){
var len = 0;
if(response['data'] != null){
len = response['data'].length;
}
if(len > 0){
for(var i=0; i<len; i++){
var id = response['data'][i].id;
var sdg = response['data'][i].sdg;
var tree = $('#tree').tree({
primaryKey: 'id',
uiLibrary: 'bootstrap4',
dataSource: [ sdg ],
checkboxes: true
});
}
}
}
});
});
});
**