Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flexigrid - how to turn off row selection

Tags:

flexigrid

Is it possible to turn off the row selection feature on Flexigrid? It's somewhat annoying when you haven't implemented anything that makes use of the selection.

alt text

like image 955
Mr. Flibble Avatar asked Feb 17 '10 14:02

Mr. Flibble


3 Answers

Unfortunately Mr Flibble's accepted answer does not stop all selection capability, it merely restricts it to one row. To disable it completely, add a new property to the $.extend block (around line 20)

// apply default properties
p = $.extend({
<SNIP>
onSubmit: false, // using a custom populate function
disableSelect: true

Then in the .click section of the row (around line 754) add a check for the property

$(this)
.click(
 function (e)
 {
  var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true;
  if (p.disableSelect) return true;
  $(this).toggleClass('trSelected');
  if (p.singleSelect) $(this).siblings().removeClass('trSelected');
 }
)
like image 115
Flapper Avatar answered Oct 20 '22 01:10

Flapper


Turns out you need to change the singleSelect property to true.

singleSelect: true
like image 39
Mr. Flibble Avatar answered Oct 20 '22 00:10

Mr. Flibble


I know this thread is a bit old but I came upon it looking for the same thing. The singleSelect didn't work for me as I didn't want to be able to select any row. I found that I could remove any row selection with a single line of code:

$('.grid tr').unbind('click');

This a course removes all bindings on the table row so if you needed the binding you won't have it unless you rebind later but I needed to remove any and all row selection on my table. I didn't need to touch the flexigrid code to do so which I liked a bit more than previous answers.

like image 28
Micah Montoya Avatar answered Oct 20 '22 01:10

Micah Montoya