我正在尝试绑定树但是获取TypeError。 json值在jqwidgets树中没有绑定。我只是在Head Tag中添加插件并声明它。
myCode:
<script type="text/javascript" src="assets/jtree/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="assets/jtree/jqxcore.js"></script>
<script type="text/javascript" src="assets/jtree/jqxbuttons.js"></script>
<script type="text/javascript" src="assets/jtree/jqxscrollbar.js"></script>
<script type="text/javascript" src="assets/jtree/jqxpanel.js"></script>
<script type="text/javascript" src="assets/jtree/jqxtree.js"></script>
jQuery(document).ready(function () {
LoadOrgUnitData();
});
function LoadOrgUnitData() {
var source = [
{ label: "Item 1", expanded: true, items: [
{ label: "Item 1.1" },
{ label: "Item 1.2", selected: true }
]
},
{ label: "Item 2" },
{ label: "Item 3" },
{ label: "Item 4", items: [
{ label: "Item 4.1" },
{ label: "Item 4.2" }
]
},
{ label: "Item 5" },
{ label: "Item 6" },
{ label: "Item 7" }
];
// Create jqxTree.
alert(source);
$('#jqxTree').jqxTree({ source: source, height: '300px', width: '300px' });
}