Hi experts,
I'm working on the tree load on demand feature. And till now, I can expand the first node successfully and the second level data appended to tree correctly. But I have no idea why I cannot expand the second level node. It does not give me an arrow to click... I paste my js code and asp.net code below, please help . Thanks in advance!!!
==============================================================================================
my js code:
var data = [ { "ID": 1, "CountryName": "North America", "Countries": [] }, { "ID": 2, "CountryName": "South America", "Countries": []
}, { "ID": 3, "CountryName": "Europe", "Countries": []
} ];
$("#alextree").igTree({ dataSource: data, //JSON Array defined above bindings: { textKey: "CountryName", valueKey: "ID", childDataProperty: "Countries", bindings: { textKey: "CountryName", valueKey: "ID" } }, dataSourceUrl: window.BAConfiguration.baseUrl + "/SessionReadOnly/TreeOnDemand", loadOnDemand: true
});
===============================================================================
the TreeOnDemand action,
public class Country { public string CountryName { get; set; } public int ID { get; set; } public List<Country> Countries { get { return new List<Country>(); } } } public JsonResult TreeOnDemand(string path, string binding, int depth) {
List<Country> c = new List<Country>(); c.Add(new Country { ID = new Random().Next(), CountryName = "country" + new Random().Next() }); return Json(c, JsonRequestBehavior.AllowGet); }
Thanks!!!
Hello Sathya,
Thank you for posting in our community!
For using load on demand for more than two levels of nodes, you can refer to the verified Michael’s answer in this topic. You will find detailed explanation and a sample attachment illustrating a possible approach.