Please assist. My code is as follows:
Razor:
@(Html.Kendo().TreeView()
.Name("geographyView")
.DataTextField("name")
.Checkboxes(true)
.DataSource(dataSource => dataSource
.Model(model => model
.Id("id")
.HasChildren("children")
).Read(read => read.Action("Geography", "Home"))
)
)
Controller:
public JsonResult Geography(long? parentGeographyId)
{
if (!parentGeographyId.HasValue)
{
ICollection<IGeography2> geography2s = CacheConfig.GeographyCache.FindGeography2();
var result = geography2s.Select(geography2 => new
{
geography2.id,
geography2.name,
children = true
}).ToList();
return Json(result, JsonRequestBehavior.AllowGet);
}
if (Convert.ToString(parentGeographyId.Value).Length == 2)
{
var geography2Id = (int) parentGeographyId.Value;
IGeography2 geography2 = _dtoFactory.NewGeography2Dto();
geography2.id = geography2Id;
ICollection<IGeography4> geography4s = CacheConfig.GeographyCache.FindGeography4(geography2);
var result = geography4s.Select(geography4 => new
{
geography4.id,
geography4.name,
children = true
}).ToList();
return Json(result, JsonRequestBehavior.AllowGet);
}
throw new ArgumentOutOfRangeException("parentGeographyId");
}
Screenshot is attached.
Basically, the first level of the tree is loaded correctly, and I can see the corresponding AJAX request going out to the controller. However, when I click an entry to expand it in order to fetch the second-level set of entries, nothing happens. The click icon disappears, and no AJAX request is seen going out to the server when viewing the Firefox's Developer Tools' Network tab.
I must be missing something either in the setup of the component (although I do follow Telerik example found here - - or I must be missing a configuration detail such as the version of a supporting component (I am using jQuery 1.9.1 and ASP.NET MVC Q2 2014 SP2).
Thank you in advance for your assistance.
Razor:
@(Html.Kendo().TreeView()
.Name("geographyView")
.DataTextField("name")
.Checkboxes(true)
.DataSource(dataSource => dataSource
.Model(model => model
.Id("id")
.HasChildren("children")
).Read(read => read.Action("Geography", "Home"))
)
)
Controller:
public JsonResult Geography(long? parentGeographyId)
{
if (!parentGeographyId.HasValue)
{
ICollection<IGeography2> geography2s = CacheConfig.GeographyCache.FindGeography2();
var result = geography2s.Select(geography2 => new
{
geography2.id,
geography2.name,
children = true
}).ToList();
return Json(result, JsonRequestBehavior.AllowGet);
}
if (Convert.ToString(parentGeographyId.Value).Length == 2)
{
var geography2Id = (int) parentGeographyId.Value;
IGeography2 geography2 = _dtoFactory.NewGeography2Dto();
geography2.id = geography2Id;
ICollection<IGeography4> geography4s = CacheConfig.GeographyCache.FindGeography4(geography2);
var result = geography4s.Select(geography4 => new
{
geography4.id,
geography4.name,
children = true
}).ToList();
return Json(result, JsonRequestBehavior.AllowGet);
}
throw new ArgumentOutOfRangeException("parentGeographyId");
}
Screenshot is attached.
Basically, the first level of the tree is loaded correctly, and I can see the corresponding AJAX request going out to the controller. However, when I click an entry to expand it in order to fetch the second-level set of entries, nothing happens. The click icon disappears, and no AJAX request is seen going out to the server when viewing the Firefox's Developer Tools' Network tab.
I must be missing something either in the setup of the component (although I do follow Telerik example found here - - or I must be missing a configuration detail such as the version of a supporting component (I am using jQuery 1.9.1 and ASP.NET MVC Q2 2014 SP2).
Thank you in advance for your assistance.