Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to Stop jqGrid row(s) from being selected and/or highlighted?

Tags:

I've looked at the documentation but I've been unable to find an answer. Is there a way to prevent a row from being highlighted when selected? That or even a way to stop the row being selected at all. I like the "hoverrows: true" option, but ideally I would like to stop a row from being selected on-click.

Thanks,

Update: I've been able to "hackily" implement something which seems to be an interim fix. I don't really like it at all and would idealy like a better solution, if there is one...

I have found that if I pass the option

onSelectRow: function(rowid, status) {     $('#'+rowid).removeClass('ui-state-highlight'); } 

when I instantiate the jqGrid, I can strip the highlight when it is added.

Is there another, more ideal, way to do this?

like image 849
Mike Avatar asked Jan 27 '10 15:01

Mike


People also ask

How do you unselect a row in jQGrid?

If the text field value is zero while selecting the particular row in jqgrid at that time validate that with javascript and uncheck the selected row from the grid. myGrid is my grid id. resetSelection is a method in the jQGrid to unselect the selected rows.

How do I disable jQGrid?

The grid actions are disabled by setting the check box value to the grid members through the setModel property and grid is disabled by adding the e-disable class with the grid class.

What is jQGrid?

jqGrid is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the web.


2 Answers

Use the following code:

beforeSelectRow: function(rowid, e) {     return false; } 
like image 57
Vinodh Ramasubramanian Avatar answered Jan 03 '23 12:01

Vinodh Ramasubramanian


If you, like me, have a gazillion jqGrids and don't want to override onSelectRow for every single one, here's a global version of Reigel's solution that worked nicely for me:

jQuery.extend(jQuery.jgrid.defaults, {     onSelectRow: function(rowid, e) {         $('#'+rowid).parents('table').resetSelection();     } }); 
like image 29
eliland Avatar answered Jan 03 '23 12:01

eliland