Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json FancyTree有空节点_Json_Jquery Plugins_Fancytree - Fatal编程技术网

Json FancyTree有空节点

Json FancyTree有空节点,json,jquery-plugins,fancytree,Json,Jquery Plugins,Fancytree,我从演示中直接获得了以下代码: $("#treetable").fancytree({ extensions: ["table"], table: { indentation: 20, // indent 20px per node level nodeColumnIdx: 0 // render the node title into the 1st column }, source: {url: "productTree.json"}, rendercolumns: function(e

我从演示中直接获得了以下代码:

$("#treetable").fancytree({
extensions: ["table"],
table: {
indentation: 20,  // indent 20px per node level
nodeColumnIdx: 0  // render the node title into the 1st column
},
source: {url: "productTree.json"},
rendercolumns: function(e, data) {
var node = data.node,
$tdList = $(node.tr).find(">td");
// (index #0 is rendered by fancytree - see above)
$tdList.eq(1).text(node.modeldet);
$tdList.eq(2).text(node.key);
$tdList.eq(3).text(node.inclusion);
 }
});
这是JSON:

[
{"title": "All Products", "key": "*", "folder": true, "children": [
    {"title": "Smart Product 1", "key": "Smart", "inclusion": "Mandatory", "folder": true, "children": [
        {"title": "Simple A", "key": "One Time Fee", "modeldet": "0-50 Units"},
        {"title": "Simple B", "key": "Per Unit or Metered Usage", "modeldet": "More than 50 Units"}
    ]},
    {"title": "Simple A", "key": "One Time Fee", "inclusion": "Mandatory"},
    {"title": "Simple B", "key": "Per Unit or Metered Usage", "inclusion": "Mandatory"},
    {"title": "Simple C", "key": "Reservation", "inclusion": "Optional", "extraClasses": "my-extra-class" },
    {"title": "Simple D", "key": "Service or Recurring Fee", "inclusion": "Optional", "extraClasses": "my-extra-class" }
]}  
]

树呈现,但包含数据的列只有“标题”和“键”。其他为空。

大多数自定义节点数据存储在单独的命名空间中,以避免冲突。 尝试改为以“node.data.modeldet”身份访问