javascript - How do I remove checked nodes from a Kendo TreeView? -
here's 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 click event of button "delete," want remove of nodes checked.
$(document).ready(function() { $('#btndelete').click(function() { var treeview = $('#treeview').data("kendotreeview"); var selectednodes = treeview.select(); //here's im not sure do... }); });
the tree view here in markup (i know mess... i'm guy fixing 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 kendo treeview
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')); }); }); });
Comments
Post a Comment