我正在使用插件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; }
}第一级数据显示正确,但当我单击节点时,相同的数据再次绑定。如果我缺少任何按需加载的配置设置,请提供建议

发布于 2015-11-18 22:04:30
在当前配置中,igTree使用dataSourceUrl从用于绑定初始级别的同一控制器操作请求新数据。此时,您需要使用树提供给控制器操作的参数-路径、绑定和深度-来返回正确的数据层。
Here's an example of how you can do this.
https://stackoverflow.com/questions/33744214
复制相似问题