0
Laravel 4
및 fancytree
을 사용하고 있습니다.Fancytree가 특정 json 요소의 데이터를로드합니다.
{
"error":false,
"survey_data":"[{
"id": 1,
"type": "group",
"subtype": null,
"title": "General ",
"parent": null,
"children": [{
"id": 30,
"type": "question",
"subtype": "boolean",
"title": "Did you..?",
"parent": 1,
"children": [{
"id": 31,
"type": "answer",
"subtype": null,
"title": "Yes",
"parent": 30,
"children": []
}]
}]
}]
}
내가 fancytree
에 요소 survey_data
의 JSON
을로드 할 :
JSON
데이터 뭔가 같이 돌려 주어
api
전화를 가지고있다.
현재, 내 코드는 다음과 같은 것입니다 : 변수 sourceURL
에서
var tree = function (treeDiv,sourceURL){
treeDiv.fancytree({
source : sourceURL
})
}
내가 통과하고있는 api url
와 내가 올바른 JSON
데이터를 얻고 불을 지르고 확인했다. 그러나 나는 이것을로드하는 방법을 모르겠다. survey_data
JSON
을 출처로 사용한다.
가 나는 또한 시도 :
source: jQuery.ajax({
url: sourceURL,
type: 'GET',
dataType: 'json',
complete: function(xhr, textStatus) {
},
success: function(data, textStatus, xhr) {
return data.survey_data;
},
error: function(xhr, textStatus, errorThrown) {
}
})
그러나 점점 오류 :
Uncaught Error: Assertion failed: source must contain (or be) an array of children
내가 fancytree
의 최신 버전을 사용하고 있습니다 있습니다.
아무도 도와 줄 수 있습니까?
감사합니다.
어떤 생각? 게으른로드 중일 때 postProcess 함수가 호출되지 않습니다. – Displee