0

我有以下数据结构,我想在以 Dyntree 格式给出的数据结构中使用它:

[
  {
    title: "my Title",
    isFolder: "true",
    key: 1
  }
]

我在 JS 变量中将上述数据结构设置为 STRING。

当我将此值设置为 javascript 变量时,它会给出无效类型的错误

DynTree 格式如下所示;

 var fakeJsonResult = [
          { title: 'Lazy node 1', isLazy: true },
          { title: 'Simple node 2', select: true }
        ];
4

1 回答 1

1

如果您想从您提到的对象创建一个动态树,这很简单,只需执行此操作

var children = [
  {
    title: "my Title",
    isFolder: "true",
    key: 1
  }
];

$('#tree').dynatree({

   children : children

});
于 2013-08-31T07:54:41.530 回答