0

I use dynatree to display a list of documents. When I load the template, the dynatree was stuck in the loading icon. What could be wrong?

$("#tree").dynatree({
checkbox: true,
selectMode: 2,
initAjax: {
  url: "/getTree/",
  dataType: "json",
  data:  {}
},
onSelect: function(node) {
     },
onActivate: function (node) {
},
persist: true,
noLink: false,
fx: { height: "toggle", duration: 200 },
onPostInit: function (isReloading, isError) {
    if (getStringOfSelectedTreeNodes() != '') {
             }
 }
 }); }); 
 </script>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
v4graph
  • 81
  • 6

1 Answers1

0

Did you have an example maybe on CodePen to check what the issue is. It seems the last }); end braces was not needed, was this because it was within a jQuery $(document).ready(); method. Otherwise this would be the correct code: Some good examples on the dynatree example page which I'm sure you've seen.

$("#tree").dynatree({
  checkbox: true,
  selectMode: 2,
  initAjax: {
    url: "/getTree/",
    dataType: "json",
    data:  {}
  },
  onSelect: function(node) {
  },
  onActivate: function (node) {
  },
  persist: true,
  noLink: false,
  fx: { height: "toggle", duration: 200 },
  onPostInit: function (isReloading, isError) {
    if (getStringOfSelectedTreeNodes() != '') {
    }
  }
});
svnm
  • 22,878
  • 21
  • 90
  • 105