Hi,
I am trying to work out how I can disable nodes in a TreeView based on whether the node is checked. For some reason I'm not able to retrieve the TreeView as such I am unable to iterate through the nodes and get the ones that are checked.
Here is my code:
Controller
public class HomeController : Controller
{
CalendarEventsEntities2 db = new CalendarEventsEntities2();
private SchedulerMeetingService meetingService;
public ActionResult SideNavMenu()
{
return View();
}
}
View
<div class="demo-section k-content">
@(Html.Kendo().TreeView()
.Name("treeview")
.DataTextField("Name")
.DataUrlField("LinkURL")
.Checkboxes(true)
.HighlightPath(true)
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Menu", "Home")
)
)
)
</div>
<script>
$(document).ready(function() {
var treeView = $("#treeview").data("kendoTreeView");
var nodes = treeView.dataSource.view();
for (var i = 0; i < nodes.length; i++) {
alert('uuu');
var node = nodes[i];
//sets the parent node check property to true
node.set("checked",true);
if (node.checked) {
if (node.hasChildren){
var children = node.loaded() && node.children.data();
for (var i = 0; i < children.length; i++) {
node.children.at(i).set("enabled", false);
}
} else {
if (node.hasChildren) {
for (var i = 0; i < node.children.length; i++) {
node.children.at(i).set("enabled", true);
}
}
}
}
};
});
</script>
I would like to see a full working project with the spreadsheet and MVC, like the many grid examples, however I could not find any in Github.
Thanks
I have a scheduler code like below, but it is not working although it has rendered a drop-down list but no data inside. Any help?
<script id="popup_editor" type="text/x-kendo-template">
<div class="k-edit-form-container">
<div class="k-edit-label"><label for="Product">Product</label></div>
<div id="example" class="k-edit-field" data-container-for="ProductID">
<input data-role="dropdownlist" data-text-field="Name" data-value-field="Id" data-bind="source: arr" />
</div>
</div>
</script>
@(Html.Kendo().Scheduler<KendoUI.Northwind.Dashboard.Controllers.ScheduleTableViewModel>()
.Name("scheduler")
.Editable(editable => editable
.EditRecurringMode(SchedulerEditRecurringMode.Dialog)
.TemplateId("popup_editor")
)
.Selectable(false)
.Views(views =>
{
views.DayView();
views.WeekView();
views.WorkWeekView(workWeekView => workWeekView.Selected(true));
views.MonthView();
views.AgendaView();
views.TimelineView();
})
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.RecId);
m.Field(f => f.Title).DefaultValue("No title");
m.RecurrenceId(f => f.RecurrenceID);
})
.Read(read => read.Action("ScheduleTables_Read", "SchedulerMvc"))
.Create(create => create.Action("ScheduleTables_Create", "SchedulerMvc"))
.Update(update => update.Action("ScheduleTables_Update", "SchedulerMvc"))
.Destroy(destroy => destroy.Action("ScheduleTables_Destroy", "SchedulerMvc"))
)
<script>
var arr = new kendo.data.ObservableArray([
{ Name: "John Doe", Id: 23 },
{ Name: "Jane Doe", Id: 34 }
]);
var viewModel = kendo.observable({
arr: arr //Temp solution, eventually will bind to a remote
});
kendo.bind($("#popup_editor"), viewModel);
</script>
Hi, May I know how to add additional Textbox field either in or numeric? I able to add a list using the Resource, but it seems unable to add a textbox.
Thank you.
HI
I known textbox could be placed in HeaderTemplate.
Single TextBox as filter row in each column header
https://www.telerik.com/forums/single-textbox-as-filter-row-in-each-column-header
example
http://dojo.telerik.com/UbeFu
But Navigatable() method causes textbox not focused automatically on click.
How can I solve this kind of problem.
*input/type=checkbox works well but input/type=text not works :
.HeaderTemplate("<input type='text' />");
*Telerik DevCraft R2 2017 SP1.
Best regards
Chris
Hello,
I wish to be able to turn off the browser auto complete on the filter options (search and entering values).
Normally I would just add the following to the input but that doesn't appear to be working. We are using the MVC wrappers.
.attr('autocomplete', 'off');
Thank you
Lucy
Is there a server binding hierarchy web forms example floating around out there?
I see example projects: server-hierarchy and server-binding but am having trouble understanding how to use it in a web forms based MVC project.
In the view for server-binding example:
@model IEnumerable<KendoGridServerBinding.Models.Product>
@(Html.Kendo().Grid(Model)
// Bind the grid to the Model property of the view
and in the view for server-hierarchy example project:
@(Html.Kendo().Grid((IEnumerable<
KendoGridServerHierarchy.Models.Category
>)ViewBag.Categories)
Can someone explain the difference for referencing the controller server data in the two example projects?
Hi,
I have implemented a popup window that display a text and I need to close the popup if the user clicks outside of the window. Searching in telerik forums I have found that there is way to do this using the method $telerik.isMouseOverElementEx. But this method is available only for Telerik ASP.NET Ajax.
Is there an equivalent for this method in the product Telerik ASP.NET MVC?