Maybe there's some difference in Telerik/Kendo MVC behaviour here?
I've been converting some code from the Telerik MVC components to the Kendo MVC equivalents.
I have a Kendo grid in which one of the columns has embedded a Kendo menu. However when the menu is moused over the menu does not expand, nor does it do so when the menu is clicked.
I've created two small sample projects, one showing the menu expanding on hover as expected with the Telerik components, the other project has been ported to Kendo and the menu no longer displays.
I've made only minor changes to have the code run with Kendo, including updating the menu name to use the revised template format and adding a call to ToClientTemplate when building the menu.
The projects are larger than the allowed 2MB limit so I've shared them via SugarSync.
https://www.sugarsync.com/pf/D104910_65492427_756235
Why though does the menu not display with the Kendo code?
Here's the code;
View
Model
Action
I've been converting some code from the Telerik MVC components to the Kendo MVC equivalents.
I have a Kendo grid in which one of the columns has embedded a Kendo menu. However when the menu is moused over the menu does not expand, nor does it do so when the menu is clicked.
I've created two small sample projects, one showing the menu expanding on hover as expected with the Telerik components, the other project has been ported to Kendo and the menu no longer displays.
I've made only minor changes to have the code run with Kendo, including updating the menu name to use the revised template format and adding a call to ToClientTemplate when building the menu.
The projects are larger than the allowed 2MB limit so I've shared them via SugarSync.
https://www.sugarsync.com/pf/D104910_65492427_756235
Why though does the menu not display with the Kendo code?
Here's the code;
View
@using MvcMenuPopup.Models@{ ViewBag.Title = "People";}<h2>Some People</h2> @(Html .Kendo() .Grid<Person>() .Name("peopleGrid") .Columns(columns => { columns.Template(t => { }).ClientTemplate( Html .Kendo() .Menu() .Name("themenu#=PersonId#") .Items(menu => menu.Add().Text("::").Items(sub => { sub.Add().Text("Do this thing"); sub.Add().Text("Do that thing"); })) .Orientation(MenuOrientation.Vertical) .HighlightPath(true) .OpenOnClick(false) .ToClientTemplate() .ToHtmlString() ) .HtmlAttributes(new { @class = "navigationColumn", style = "overflow: visible;" }) .Width(50); columns.Bound(t => t.Birthday); columns.Bound(t => t.FirstName); columns.Bound(t => t.Surname); }) .DataSource(binding => binding.Ajax().Read("PeopleAjax", "Home")))Model
namespace MvcMenuPopup.Models{ using System; public class Person { public long PersonId { get; set; } public DateTime Birthday { get; set; } public string FirstName { get; set; } public string Surname { get; set; } }}Action
namespace MvcMenuPopup.Controllers{ using System; using System.Linq; using System.Web.Mvc; using Kendo.Mvc.Extensions; using Kendo.Mvc.UI; using MvcMenuPopup.Models; public class HomeController : Controller { public ActionResult Index() { return this.View(); } public ActionResult About(string firstName) { return this.View((object)firstName); } public JsonResult PeopleAjax([DataSourceRequest]DataSourceRequest request) { DataSourceResult result = GetPeople().OrderByDescending(train => train.Birthday).ToDataSourceResult(request); return this.Json(result); } private static IQueryable<Person> GetPeople() { var birthdays = Enumerable.Range(1, 12).Select(month => new DateTime(1980, month, 1)).ToList(); return birthdays.Select((date, index) => new Person { PersonId = index, Birthday = date, FirstName = "Bill" + index, Surname = "Smith" + index }).AsQueryable(); } }}