rifanece / jquery-datatables-column-filter

Automatically exported from code.google.com/p/jquery-datatables-column-filter
0 stars 0 forks source link

Clicks on filter inputs also cause sort event to be triggered in merged filter/sort headers #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a table with a single row in the thead and no tfoot
2. Setup a datatable column filter instance with sPlaceHolder: head:before/after
3. Click into any of the new filter input elements (text, select) to change the 
value

What is the expected output? What do you see instead?
I expect to be able to set the value w/ altering the sorting, but the sort 
event is triggered at the same time.

What version of the product are you using? On what operating system?
Tried with both the current stable version and the trunk version, with 
dataTables 1.9.0 in Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) 
Gecko/20100101 Firefox/9.0.1

Please provide any additional information below.

This can be fixed easily enough by binding to the click event on each created 
filter input element and calling stopPropagation() on the event. 
http://api.jquery.com/event.stopPropagation/

Example: (from inside fnCreateColumnSelect function on trunk)

nTh.wrapInner('<span class="filterColumn filter_select" />');
select.click(function(e){e.stopPropagation();});
select.change(function () { ...

Original issue reported on code.google.com by chrisblo...@gmail.com on 9 Feb 2012 at 9:29

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

If you are using heading:after/before you must put duplicate heading row see 
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/dateRange.html 
as example. 
I will not prevent any event that is fired by datatable plugin and therefore 
one heading row is used for Allan's datatable sorting events, while another row 
is for my column filter.

Regards,
Jovan

Original comment by joc...@gmail.com on 12 Feb 2012 at 6:31