Right click menu correctly works with its functions. But the issue is sometimes it is not working properly. In my view if right clicked on the table row checked the checkbox correctly but after I unchecked and try checked again with right click its not working.
$('.check').bind("contextmenu", function (event) {
event.preventDefault();
$(".custom-menu").finish().toggle(100).css({
top: event.pageY + "px",
left: event.pageX + "px"
});
});
$(document).bind("mousedown", function (e) {
if (!$(e.target).parents(".custom-menu").length > 0) {
$(".custom-menu").hide(100);
}
});
$('tr.check').contextmenu(function (e) {
$cb = $(this).find('input[type="checkbox"].selected_check');
$($cb).attr('checked', 'checked');
populate_context_menu($cb);
return false;
});
I changed my code with some code lines, and its helps to me.
$(".custom-menu li").click(function () {
$(".custom-menu").hide(100);
});
function isExist(id) {
for (var i = 0; i < values.length; i++) {
if (values[i] == id) {
return true;
}
}
return false;
}
$('tr.check').contextmenu(function (e) {
$cb = $(this).find('input[type="checkbox"].selected_check');
var id = $($cb).attr('id');
var result = isExist(id);
if (!result) {
$('.selected_check').attr('checked', false);
$('.check').removeClass('highlight_row');
$('.check').addClass('td_bgcolor');
}
$($cb).attr('checked', 'checked');
populate_context_menu($cb);
return false;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With