Disable ordering when click on an icon in DataTable header
Disable ordering when click on an icon in DataTable header
Floriane
Posts: 22Questions: 6Answers: 0
Hi,
I want to integrate filters on headers of a DataTable. I have add an image in every "th" tag and I send an alert on click.
My problem is that when I click on my icon, the click event for filter is well send but the event for sort is send too... And I don't want this.
Here is my test case :
<a class="jsbin-embed" href="http://live.datatables.net/wujituf/5/embed">DataTables - JS Bin</a>
Have you an idea, how can I disable sort when I click on filter icon ?
Thank you.
This discussion has been closed.
Answers
Have a look at the options that are set on this page
http://datatables.net/examples/advanced_init/defaults.html
When I added them in to your example the sorting on click was disabled.
Cheers,
Paul
Hi Paul,
Your solution works fine but i want to disable sorting only when I click on filter icon. And "ordering": false is for the initialisation. I don't know if a function exist for disable this when the DataTable is already initialised.
Thank you.
Does anyone know if a function exists to disable / enable ordering columns after initialisation ?
Thank you.
Ok, j'ai résolu mon problème grâce à Trollchik sur son poste ici: http://datatables.net/forums/discussion/4182/select-filter-in-table-header
Byebye.