2013-07-31 2 views
2

가 여기 내 구성입니다 : 버튼의 클릭 이벤트에검도 트리 뷰에서 검사 된 노드를 제거하려면 어떻게합니까?

$(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"] 
    }); 
}); 

내가 체크 모든 노드를 제거하려면 "삭제".

$(document).ready(function() 
{ 
    $('#btnDelete').click(function() 
    { 
     var treeView = $('#treeview').data("kendoTreeView"); 
     var selectedNodes = treeView.select(); 
     //here's where im not sure what to do... 
    }); 
}); 

트리보기가 (내가 지금이 모든 혼란을 고정 사람이야 ... 혼란을 알고) 마크 업에 여기에 있습니다 :

<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 

답변

3

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')); 
     }); 
    }); 

}); 
+0

손 주셔서 감사합니다! 불행히도 이것은 체크 박스 선택이 아닌 노드 선택에 기반한 노드를 제거합니다 ... 노드의 해당 체크 박스 체크를 기반으로 어떻게 체크합니까? –

+0

아! 체크 박스에 첨부 된 클래스 이름은 무엇입니까? – dcodesmith

+0

@ Rj. 완료 됐나요? – dcodesmith

관련 문제