【问题标题】:Infragistics IgniteUI Tree Load OnDemandInfragistics IgniteUI 树按需加载
【发布时间】:2015-11-16 20:41:43
【问题描述】:

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

我对树的声明是:

$("#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 输出是

 return Json(agrmnts, JsonRequestBehavior.AllowGet);

在哪里

 List<Agreements> agrmnts = new List<Agreements>();

类定义如下:

 [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; }

    }

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

【问题讨论】:

    标签: javascript jquery asp.net-mvc infragistics ignite-ui


    【解决方案1】:

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

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

    【讨论】:

    • 如何按需在 iggrid 中加载组合框列?我有一个编辑器窗口,其中有一列带有一个组合框,打开时没有填充。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-24
    • 2012-01-15
    • 2019-03-23
    相关资源
    最近更新 更多