How can you programatically disable the grid from highlighting a row when you hover over it with your mouse? Looking to do disable this only at certain times.
This is the code from Oleg which worked:
$('#result-close').click(function() {
//Turn off hover highlighting
$("#list").unbind('mouseover');
$("#list").unbind('mouseout');
//Highlight row
$("#" + selid).effect("highlight", {}, 5000);
//Turn on hover highlighting
setTimeout(function(){
开发者_开发问答$("#list").bind('mouseover',function(e) {
ptr = $(e.target).closest("tr.jqgrow");
if($(ptr).attr("class") !== "subgrid") {
$(ptr).addClass("ui-state-hover");
}
return false;
}).bind('mouseout',function(e) {
ptr = $(e.target).closest("tr.jqgrow");
$(ptr).removeClass("ui-state-hover");
return false;
});
}, 2000);
$('#dialog').dialog( "close" );
});
Use hoverrows:false
option.
A simple Google search revealed this source: http://www.trirand.net/examples/appearance/highlight_on_hover/default.aspx
"By default, jqGrid hightlight rows on hover. This is controlled by the AppearanceSettings.HighlightRowsOnHover property - setting it to false will disable that."
I'm currently replacing the existing mouseover handler with an intermediate function that just calls the existing handler if the grid is enabled, like this:
var enabled = true;
var jqe = jQuery("#grid");
var mouseover = jqe.data('events').mouseover[0].handler;
jqe.unbind('mouseover');
jqe.bind('mouseover', function() {
if (enabled) {
mouseover.apply(this, arguments);
}
});
This way I don't have to copy the jqgrid event code.
I don't like the use of mouseover[0].handler, but it works for the moment.
精彩评论