使用AngularJS的DXTreeview不允许扩展分支

时间:2015-07-26 04:45:17

标签: angularjs html5 google-chrome asp.net-mvc-5 devextreme

我有一个带有以下Index.aspx的MVC5项目 当我在VS2013中运行项目时,我只能看到树的顶部分支,没有明显的方法来扩展它们。

as shown here

Resharper表示我的参考文献没问题。

我是HTML5编程和Angular的新手。如何解决此问题?

Index.aspx是

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html>
<html data-ng-app="myApp">
<head runat="server">
    <meta name="viewport" content="width=device-width"/>
    <title>Index</title>
    <link rel="stylesheet" type="text/css" href="/Content/dx.common.css"/>
    <link rel="stylesheet" type="text/css" href="/Content/dx.light.css"/>
    <script src="/Scripts/jquery-2.1.4.min.js"></script>
    <script src="/Scripts/angular.js"></script>
    <script src="/Scripts/angular-sanitize.js"></script>
    <script src="/Scripts/jquery.globalize/globalize.js"></script>
    <script src="/Scripts/dx.webappjs.js"></script>
    <script src="/MyJS/script_Angular.js"></script>
</head>

<body>
    <div  ng-controller="demoController">
<div dx-tree-view="{
    dataSource: treeViewData,
    dataStructure: 'plain'
}">
</div>
    </div>
</body>
</html>

和script_Angular是

var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.treeViewData = dataArray;
});

var dataArray = [
    {
        id: 1,
        text: "Animals",
        items: [
            {
                id: 2,
                text: "Cat",
                items: [
                    { id: 5, text: "Abyssinian" },
                    { id: 6, text: "Aegean cat" },
                    { id: 7, text: "Australian Mist" }
                ]
            },
            {
                id: 3,
                text: "Dog",
                items: [
                    { id: 8, text: "Affenpinscher" },
                    { id: 9, text: "Afghan Hound" },
                    { id: 10, text: "Airedale Terrier" },
                    { id: 11, text: "Akita Inu" }
                ]
            },
            {
                id: 4,
                text: "Cow"
            }
        ]
    },
    {
        id: 12,
        parentId: 0,
        text: "Birds",
        items: [
            { id: 13, text: "Akekee" },
            { id: 14, text: "Arizona Woodpecker" },
            { id: 15, text: "Black-chinned Sparrow" }
        ]
    }
];

1 个答案:

答案 0 :(得分:2)

您不应该设置选项

{{1}}

因为你的情况是hierarchical

删除dataStructure选项应该有帮助

文档为here