TableTools fnSelect without allowing for user selection

TableTools fnSelect without allowing for user selection

cdonatecdonate Posts: 9Questions: 0Answers: 0
edited July 2013 in General
I want to be able to select a row with fnSelect only if the user clicks on a specific img inside a cell. But, if I initiate my table with "oTableTools": {"sRowSelect": "single","aButtons": [ ]} the user can click anywhere on the row to select it, and if I omit the "sRowSelect": "single" I can't seem to use fnSelect.

I just want to be able to disable the user click selection. The part where I select a row only if the user clicks on the img is already done.

Is this possible? Is there a way to do it?

Thanks in advance for any help.

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    You could either unbind the click listener TableTools adds to the table, or remove it front he TableTools code. I think those are the two options. An `sRowSelect` option of API might be an interesting option for the future...

    Allan
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    ps. Please don't post the same message multiple time - it just takes my time away from reading and answering questions.

    Allan
  • cdonatecdonate Posts: 9Questions: 0Answers: 0
    Sorry for the multiple questions. Won't happen again. How should I go about unbinding the click listener? I just need you to point me to right direction.

    And, thanks for the help.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    This is the function TableTools uses to add the click listener: https://github.com/DataTables/TableTools/blob/master/media/js/TableTools.js#L1027 . So you'd just use the `off` equivalent: `$('#myTable tbody').off( 'click.DTTT_Select', 'tr' );` .

    Allan
  • cdonatecdonate Posts: 9Questions: 0Answers: 0
    Thank you very much, allan.
This discussion has been closed.