SaphuA
SaphuA

Reputation: 3150

Disable ctrl+click selection in jQuery dataTables

I am using the jQuery DataTables plugin: http://datatables.net/examples/basic_init/zero_configuration.html

By default users are able to select cells by holding the control key and clicking.

I would like to disable this functionality. There does not seem to be an option or api function for this.

Does anyone know how I can achieve this, preferably without modifying the original source?

Thanks!

Upvotes: 3

Views: 974

Answers (1)

davidkonrad
davidkonrad

Reputation: 85538

This is not a dataTables issue - it is a browser issue. There is nothing in jQuery dataTables that provides this "feature". And to be more clear : It is a FireFox specific feature that do not exists in Chrome or Opera (for example).

Try open a FireFox, go to this page and ctrlclick on your own question above. Yes - the exact same thing happens!

If you programmatically want to disable this feature, see https://support.mozilla.org/en-US/questions/763547.

Very simple, add -moz-user-select: none to elements you not want to be selected by ctrlclick in FireFox. Here is an example :

table.dataTable tbody th, table.dataTable tbody td {
    -moz-user-select: none;
}

demo -> http://jsfiddle.net/0o0h2ry7/

...disables the ctrlclick feature in FireFox for a dataTable (1.10.x)

Upvotes: 3

Related Questions