Treeview select event is not firing in kendo ui

倾然丶 夕夏残阳落幕 提交于 2021-02-10 22:39:14

问题


I have a treeview defined like

$("#treeview").kendoTreeView({
  dataSource:homogenous,
  dataBound: function(e){
       $("#treeview").data("kendoTreeView").select(".k-item:first");
 },
  select: function(){
     alert('selectd');
 }
});

Initially the treeview is selecting. But it is not getting the alert of select. But when we selecting the node it is getting the alert. How should i get rid of them.


回答1:


The select method won't fire the select event. You can however use the trigger method to fire any event:

dataBound: function(e){
   $("#treeview").data("kendoTreeView").select(".k-item:first");
   $("#treeview").data("kendoTreeView").trigger("select", { 
      node: $("#treeview .k-item:first")[0] 
   });       
},


来源:https://stackoverflow.com/questions/16932642/treeview-select-event-is-not-firing-in-kendo-ui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!