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