首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Infragistics树加载OnDemand

Infragistics树加载OnDemand
EN

Stack Overflow用户
提问于 2015-11-17 04:41:43
回答 1查看 120关注 0票数 0

我正在使用插件http://www.igniteui.com/tree/overview,并希望按需加载树数据。

我对树的声明是:

代码语言:javascript
复制
$("#tree").igTree({
            checkboxMode: "off",
            singleBranchExpand: true,
            loadOnDemand: true,
            dataSourceUrl : "/home/getagreements",
            nodeClick: function (evt, ui) {
            },
            dataSourceType: "json",
            initialExpandDepth: -1,
            pathSeparator: ".",
            bindings: {
                textKey: "Text",
                valueKey: "Value",
                imageUrlKey: "ImageUrl",
                childDataProperty: "Value",
                Description: "Description"
                },

            },
            dragAndDrop: false,
            nodeExpanding: function (evt, ui) {
            }
        });

而home/getagreements的JSON输出是

代码语言:javascript
复制
 return Json(agrmnts, JsonRequestBehavior.AllowGet);

哪里

代码语言:javascript
复制
 List<Agreements> agrmnts = new List<Agreements>();

以及如下的类定义:

代码语言:javascript
复制
 [JsonObject(MemberSerialization = Newtonsoft.Json.MemberSerialization.OptIn)]
    public class AgreementNode
    {
        [JsonProperty(Order = 1)]
        public string AgreementNbr { get; set; }

     [JsonProperty(Order = 2)]
        public string ExternalDescription { get; set; }

        [JsonProperty(Order = 3)]
        public string Description { get; set; }

        [JsonProperty(Order = 4)]
        public string EffDate { get; set; }

        [JsonProperty(Order = 5)]
        public string ExpDate { get; set; }

        [JsonProperty(Order = 6)]
        public string ReleaseStatus { get; set; }

        [JsonProperty(Order = 7)]
        public string ImageUrl  { get; set; }

        [JsonProperty(Order = 8)]
        public string Folder    { get; set; }

        [JsonProperty(Order = 9)]
        public string Value { get; set; }

        [JsonProperty(Order = 10)]
        public string Text { get; set; }




    }

    public class Agreements
    {
        public string AgreementType { get; set; }
        public string Text { get; set; }
        public string Value { get; set; }
        public string Folder { get; set; }
        public string ImageUrl { get; set; }
        public List<AgreementNode> agreements { get; set; }

    }

第一级数据显示正确,但当我单击节点时,相同的数据再次绑定。如果我缺少任何按需加载的配置设置,请提供建议

EN

回答 1

Stack Overflow用户

发布于 2015-11-18 22:04:30

在当前配置中,igTree使用dataSourceUrl从用于绑定初始级别的同一控制器操作请求新数据。此时,您需要使用树提供给控制器操作的参数-路径、绑定和深度-来返回正确的数据层。

Here's an example of how you can do this.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33744214

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档