or
filterable: {
name: "FilterMenu",
extra: true,
messages: { isTrue: "On",
isFalse: "Off"
}data-filterable='{ "name" : "FilterMenu", "extra" : "true", "messages" : "{ }" }'Hi I'm new to kendo and can't get the dragstart function to work.
I keep getting this error when trying to use the dragstart function
"ReferenceError: treeview is not defined", If I do define "treeview"
I get the error, "TypeError: treeview.data is not a function".
this is the function i used:
treeview.data("kendoTreeView").bind("dragstart", function (e) { if ($(e.sourceNode).parentsUntil(".k-treeview", ".k-item").length == 0) { e.preventDefault(); }});This is how I implemented the treeView
<div id="treeView"> @(Html.Kendo().TreeView() .Name( "treeview" ) .DragAndDrop( true ) .DataTextField( "Title" ) .LoadOnDemand( true ) .DataSource( datasource => datasource .Read( read => read .Action( "PageList", "Home" ) ) ) .Events( events => events .DragStart( "dragstart" ) ) )</div>and this is my controller code:
public class HomeController : Controller{ public ActionResult Index() { var pageList = BusinessLogic.Page.PageInfoList.Get(); return View( "Index", pageList ); } public JsonResult PageList( int? id ) { var pageInfoList = PageInfoList.Get(); var pageList = from e in pageInfoList where ( id.HasValue ? e.ParentPageId == id : e.ParentPageId == null ) select new { id = e.Id, Title = e.Title, hasChildren = (pageInfoList.Any ( p => p.ParentPageId == e.Id )) }; return Json( pageList, JsonRequestBehavior.AllowGet ); }}
Any help would be much appreciated.