2013-04-09 107 views
2

我有一些kendo treeView與遠程數據。 另外我有右鍵單擊激活的上下文菜單, 是否可以選擇節點manualy?我的意思是這個節點必須突出顯示,就像鼠標點擊一樣。也許觸發一些事件是可能的?請幫助Kendo UI TreeView右擊

$("#myTree").on('mousedown', '.k-item', function (event) { 
     if (event.which === 3) { 
      var treeView = $('#myTree').data('kendoTreeView');  
      var dataSource = treeView.dataSource; 
      var itemUId = $(this).attr("data-uid"); 
      var node = dataSource.getByUid(itemUId);       
     } 
    }) 

回答

4

您可以添加:

$("#myTree").on('mousedown', '.k-item', function (event) { 
    if (event.which === 3) { 
     event.stopPropagation(); // to avoid propagation of this event to the root of the treeview 
     $('#myTree').data('kendoTreeView').select(this);       
    } 
})