JQuery DataTables - Prevent sorting on sortable column -


i have jquery datatable checkbox in 1 of column headings:

<table id="vehtbl" class="table table-striped table-bordered">   <thead>     <tr>         ...         <th>             <input type="checkbox" id="someid" onchange="tickallboxes()" />             publish         </th>     </tr>   </thead> </table> 

my datatable initialised this:

var table = $("#vehtbl").datatable(     {         ...         "aocolumns":         [             ...             {                 "mdataprop": "somename",                 "fnrender": somefunction,                 "buserendered": false             },             ...         ]     }); 

so column sortable. need prevent sort event being fired when checkbox clicked (and tickallboxes fired result). sorting should work on column otherwise.

what potentially work bind handler "sort" event of table , prevent default if caller "someid" checkbox. haven't had success in doing so, though.

any ideas?

try add in script after datatable initialised, , see?

var table = $("#vehtbl").datatable( {     ...     "aocolumns":     [         ...         {             "mdataprop": "somename",             "fnrender": somefunction,             "buserendered": false         },         ...     ] }); // add in $('input[type=checkbox]').click(function(event){event.stoppropagation()}); 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -