我必须从mysql数据库创建一个树。问题是jstree卡在加载上。这是我的代码: $(文件)。就绪(函数(){ $( “#treeViewDiv”)。jstree({
"json_data" : {
"ajax" : {
// the URL to fetch the data
"url" : "myfolder/getData",
"data" : function (n) {
// the result is fed to the AJAX request `data` option
return {
"operation" : "get_children",
"id" : n.attr ? n.attr("id").replace("node_","") : 1
};
}
}
},
这就是我如何得到数据:
public function listAll(){
$q = <<<QRY
SELECT
id, title,lft,rgt
FROM $this->dbname.my_table_name
ORDER BY lft ASC
QRY;
和
$sourcesRepo = new myclassRepository($this->get('database_connection'), 'mydbname');
$pages = $sourcesRepo->listAll();
$return=array(
'pages' => $pages,
);
return $this->query($q);
任何人都可以帮忙,问题是什么?