I have the following declaration:
I want to override the 'HasChildren' property with a property from my own model/class and display an image next to the tree item if HasChildren is false. This is my (part of) my template:
However, I've noticed that:
1. When the property is hard-coded true, it behaves as expected - the image is hidden for all nodes
2. When the property is hard-coded false, it is ignored, and the image is shown only if the the node does not have children (default)
3. When I set the property using my own class property, (node.HasChildren = item.hasChildren;), all images are hidden, despite the fact that this bool value varies.
Is it possible to override this property successfully? If not, can I add my own custom fields to the mappings?
@(Html.Kendo().TreeView() .Name("FolderTree") .TemplateId("treeviewtemplate") .Events(e => e .Select("tvOnSelect") .DataBound("tvOnDataBound") .DragEnd("tvOnDragEnd") ) .BindTo(Model.Folders, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<TreeViewItem> mappings) => { mappings.For<PriMate.Web.Models.FolderModel>(bound => bound.ItemDataBound((node, item) => { node.Text = item.name; node.Id = item.id.ToString(); node.HasChildren = false; }) .Children(item => item.folders)); }))I want to override the 'HasChildren' property with a property from my own model/class and display an image next to the tree item if HasChildren is false. This is my (part of) my template:
# if (item.hasChildren) { # <input type="image" src="Content/images/trash.png" class="delete-node" onclick="return confirmDelete('folder', '${item.text}', '${item.id}')" title="delete ${item.text}"># } #However, I've noticed that:
1. When the property is hard-coded true, it behaves as expected - the image is hidden for all nodes
2. When the property is hard-coded false, it is ignored, and the image is shown only if the the node does not have children (default)
3. When I set the property using my own class property, (node.HasChildren = item.hasChildren;), all images are hidden, despite the fact that this bool value varies.
Is it possible to override this property successfully? If not, can I add my own custom fields to the mappings?