Reputation: 9950
Here's my configuration:
$(function()
{
var data = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "../api/notifications/byuserid/10078261",
contentType: "application/json"
}
},
schema: {
model: {
children: "notifications"
}
}
});
$("#treeview").kendoTreeView({
dataSource: data,
loadOnDemand: false,
checkboxes: {
checkChildren: true
},
dataTextField: ["notificationType", "NotificationDesc"]
});
});
On the click event of the button "Delete," I want to remove all of the nodes that are checked.
$(document).ready(function()
{
$('#btnDelete').click(function()
{
var treeView = $('#treeview').data("kendoTreeView");
var selectedNodes = treeView.select();
//here's where im not sure what to do...
});
});
The tree view is here in the markup (I know a mess... I'm the guy fixing all this mess right now):
<body onload=" Resize(); ">
<form id="frmTake2Home" runat="server">
<table class="main" style="border-style: hidden; padding: 0px">
<td class="tbody">
<table style="border-spacing: 0px; border-style: hidden; padding: 0px; vertical-align: top" width="100%" border="0">
<tr>
<td id="tdTreeView" valign="top" width="48%">
<tr>
<td colspan="2">
<div id="treeview"></div> //here's my kendo treeview
Upvotes: 2
Views: 3049
Reputation: 9614
UPDATE
$(document).ready(function(){
var treeView = $('#treeview').data("kendoTreeView");
$('#btnDelete').on('click', function(){
$('#treeview').find('input:checkbox:checked').each(function(){
treeView.remove($(this).closest('.k-item'));
});
});
});
Upvotes: 3