Filter a date column by range using a datepicker
Filter a date column by range using a datepicker
Hi!
I'm trying to filter a column by a range date using two input fields. The examples I've seen use the keyup event this way:
[code]
$('#min').keyup(function () { oTable.fnDraw(); });
$('#max').keyup(function () { oTable.fnDraw(); });
[/code]
I'm trying to use a datepicker (the jquery UI one) to let the user choose the date from it, so I used the change() event, as the user won't press any key to select the date:
[code]
$('#min').change(function () { oTable.fnDraw(); });
$('#max').change(function () { oTable.fnDraw(); });
[/code]
I've tested that the change event is captured, but it doesn't launch the function declared in:
[code]$.fn.dataTableExt.afnFiltering.push(....);[/code]
I think it's because it's only executed with the keyup event, but I'm not sure. Any ideas?
Thanks
I'm trying to filter a column by a range date using two input fields. The examples I've seen use the keyup event this way:
[code]
$('#min').keyup(function () { oTable.fnDraw(); });
$('#max').keyup(function () { oTable.fnDraw(); });
[/code]
I'm trying to use a datepicker (the jquery UI one) to let the user choose the date from it, so I used the change() event, as the user won't press any key to select the date:
[code]
$('#min').change(function () { oTable.fnDraw(); });
$('#max').change(function () { oTable.fnDraw(); });
[/code]
I've tested that the change event is captured, but it doesn't launch the function declared in:
[code]$.fn.dataTableExt.afnFiltering.push(....);[/code]
I think it's because it's only executed with the keyup event, but I'm not sure. Any ideas?
Thanks
This discussion has been closed.
Replies
If so, I did something similar using:
[code]
aoData.push( { "name": "min", "value": $('#min').val() } );
aoData.push( { "name": "max", "value": $('#max').val() } );[/code]
and
[code]
$('#min').change( function () { oTable.fnFilter( $(this).val(), 0 );} );
$('#max').change( function () { oTable.fnFilter( $(this).val(), 0 );} );[/code]
have a look at my post, last entry works a treat...
http://datatables.net/forums/comments.php?DiscussionID=2103&page=1#Item_6