简体   繁体   English

如何在Jquery中取消绑定网格视图行单击事件

[英]How to unbind the grid view row click event in Jquery

I need to unbind datagrid row click event, 我需要解除绑定数据网格行单击事件,

I have tried a lot using 我已经尝试了很多

 $.each(gridData, function (index, row) { if (row) { if (row["Islicense"].toString() == "false") { $('.grid_table tr').each(function () { var ballyDataGridRow = $(this); if (ballyDataGridRow.attr('valuemember') == row["ComponentID"]) { // ballyDataGridRow.find("tr").unbind('click'); //ballyDataGridRow.find("tr").undelegate("click"); // ballyDataGridRow.find("tr").off("click"); //ballyDataGridRow.find('input').prop("disabled", true); } }); } } }); 

I have used unbind,undelegate,off, even its not working 我已经使用了unbind,undelegate,off,即使它不起作用

If your ballyDataGridRow has had a click attached, then there is no need for the find('tr') as that is the tr already. 如果您的ballyDataGridRow附加了单击,则不需要find('tr')因为那已经是tr

eg use this instead 例如用这个代替

ballyDataGridRow.off("click");

or 要么

ballyDataGridRow.unbind("click");

At the moment you are searching for a tr within each tr , which is like doing this: 此刻的你正在寻找一个tr每个内tr ,就像这样:

$('.grid_table tr tr')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM