日期:2014-05-17  浏览次数:20378 次

DynaTree返回List的问题
我做了一个List<>的Tree结构,返回是这样的:
            List<myTreeNode> dyTree = Tdata.GetDyTreeMList();
            object obj = new { Success = true, Message = "OK", List = dyTree };
            return Json(obj, JsonRequestBehavior.AllowGet);

页面上:
 <script type="text/javascript">
            alert("QQ");
            $(document).ready(function () {
                // Attach the dynatree widget to an existing <div id="tree"> element   
                // and pass the tree options as an argument to the dynatree() function:   
                $("#tree").dynatree({
                    initAjax: {
                        type: "POST",
                        dataType: "json",
                        url: "/myTs/GetJsTreeList",
                        data: { id: 10 },
                        error: function (exp) {
                            alert('Error : ' + exp.responseText);
                        }
                    },

                onActivate: function (node) {