IE : unwanted form submit when a sort is triggered using keyboard

IE : unwanted form submit when a sort is triggered using keyboard

agkaagka Posts: 3Questions: 0Answers: 0
edited March 2013 in Bug reports
I admit that this may not be considered as a bug;
imho the event object should be passed to custom sort handlers, or maybe the custom listener should be required to return a boolean value to prevent event propagation.


I have a sortable table inside a form; there is a radio input on each row.
When using only the keyboard, since the key used to trigger a sort is 'enter', the form is also submitted, which is not the wanted behavior.

I did not find a way to reach the event object using the API ( fnSortListener() does not get the event ), so I just added an extra event handler

[code]
$('.dataTables_scrollHead thead th').bind('keypress.DT', function (e) {
if ( e.which === 13 ) {
e.preventDefault(); // avoid form submit on ener
}
});
[/code]
This discussion has been closed.