0
我目前正在嘗試jstree列出我的Dropbox API中的文件夾,但只有1個文件夾正在顯示,但我必須在我的Dropbox中2個文件夾..但是,當我安慰功能console.log(entry);
該reposnse正在顯示的2個文件夾,但是當我把函數的jstree只有1個文件夾是顯示和文件夾的數據是在console.log(entry);
只有1個文件夾在jstree中調用
var dbx = new Dropbox({ accessToken: access_token1 });
dbx.filesListFolder({ path: "" })
.then(function(response) {
response.entries.forEach(function(entry) {
if (entry.tag == 'folder') {
entry.parent = '#'
}
entry.text = entry.name
console.log(entry);
console.log(entry.name);
$("#people").jstree({
// generating tree from json data
"json_data": {
"data": {
"data": entry.name,
"state": "closed",
},
},
// plugins used for this tree
"plugins": ["json_data", "ui", "types", "crrm"]
})
.bind("loaded.jstree", function() {
// do stuff when tree is loaded
$("#people").addClass("jstree-sugar");
$("#people > ul").addClass("list");
$("#people > ul > li > a").addClass("jstree-clicked");
})
.bind("select_node.jstree", function(e, data) {
// do stuff when a node is selected
data.inst.toggle_node(data.rslt.obj);
});
})
///end of response
})
.catch(function(error) {
console.log(error);
});