Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery KendoUI grid如何在行选择期间防止默认值_Jquery_Asp.net Mvc_Kendo Ui_Kendo Grid_Preventdefault - Fatal编程技术网

Jquery KendoUI grid如何在行选择期间防止默认值

Jquery KendoUI grid如何在行选择期间防止默认值,jquery,asp.net-mvc,kendo-ui,kendo-grid,preventdefault,Jquery,Asp.net Mvc,Kendo Ui,Kendo Grid,Preventdefault,我有一个可选择的肯多格里德 剃须刀: @(Html.Kendo().Grid<model>() .Selectable() .Events(events => events.Change("OnRowSelect")) ) function OnRowSelect(e){ if(!condition) { //if specified condition is true, don't highlight/select the row

我有一个可选择的肯多格里德

剃须刀:

@(Html.Kendo().Grid<model>()
        .Selectable()
        .Events(events => events.Change("OnRowSelect"))
)
  function OnRowSelect(e){
    if(!condition) { //if specified condition is true, don't highlight/select the row
      e.preventDefault(); //my function passes the condition and trigger this line
    }
  }
我想做的是在选择不满足条件时取消/阻止选择。但在上面的代码中,当代码传递到
e.preventDefault()
时,它仍然选择该行。在调用
OnRowSelect
函数时,该行似乎已经被选中。在剑道
更改
事件之前是否有触发的事件?还是我错过了什么


如何防止它选择行?任何帮助都将不胜感激。提前谢谢

更改
事件之前不会触发任何事件,但您可以清除您的选择:

function OnRowSelect(e){
    if(!condition) { 
        e.sender.clearSelection(); 
    }
}