Is it possible to stop table sorting if user clicks on div inside of table header th?
In my case div has function onClick="resize(e)" on which I do:
function resize(e) {
if (!e) var e = window.event;
e.stopPropagation();
....
But it doesn’t work.
Edit: Table is sorted before e.stopPropagation() or return false
I made two demos for you. The first one has the content of the table header wrapped in a span and the second one uses the undocumented
onRenderHeaderfunction to add thespaninside the header. Either way, only the contents of thespanare clickable (the text) while clicking outside of the content will sort the column. If you use adivonly the header padding is available to initialize a column sort.Demo 1 – header contents wrapped in the markup
Demo 2 – header content wrapped using the
onRenderHeaderoptionIf you need more information on using the
onRenderHeaderoption, check out my blog post on what’s missing in the documents.