Prolem when use Column Fliter with datatable 1.8.2
Prolem when use Column Fliter with datatable 1.8.2
Hello Allan,
i am using Column Fliter (download from http://datatables.net/extras) to do the column filtering, but i found a problem when i use Column Fliter together with datatable 1.8.2.
For example: http://jquery-datatables-column-filter.googlecode.com/svn/trunk/dateRange.html
It works fine when i use datatable 1.7.5
But when i change to use datatable 1.8.2, a problem happens; the head of the table becomes unable to be clicked to sort the table. instead, the row where the filters are in becomes clickable, so when i click one filter, it will do the sorting together with the filtering which is not what i want.
I know the problem can be resolved by changing back to use datatable 1.7.5, but i would like to use datatable 1.8.2 as it supports Ajax sourced data (array of objects) .
Could you advise on this?
Many thanks,
Ruixia
i am using Column Fliter (download from http://datatables.net/extras) to do the column filtering, but i found a problem when i use Column Fliter together with datatable 1.8.2.
For example: http://jquery-datatables-column-filter.googlecode.com/svn/trunk/dateRange.html
It works fine when i use datatable 1.7.5
But when i change to use datatable 1.8.2, a problem happens; the head of the table becomes unable to be clicked to sort the table. instead, the row where the filters are in becomes clickable, so when i click one filter, it will do the sorting together with the filtering which is not what i want.
I know the problem can be resolved by changing back to use datatable 1.7.5, but i would like to use datatable 1.8.2 as it supports Ajax sourced data (array of objects) .
Could you advise on this?
Many thanks,
Ruixia
This discussion has been closed.
Replies
I've just tried the example you linked to with DataTables 1.8.2 and it seems to work okay for me. In fact the version running in the file you linked to is 1.8.2 ( http://jquery-datatables-column-filter.googlecode.com/svn/trunk/media/js/jquery.dataTables.js ).
Do you have the filters being put in after the column headers, or before? You might need to use bSortCellsTop ( http://datatables.net/ref#bSortCellsTop ) to have DataTables use different cells for sorting.
Allan
Thank you very much for the quick responase. I did the test by using the package download from http://datatables.net/extras. and that problem happened.
I try your method ( use bSortCellsTop). it works fine. Thank you :)
Another question, I am trying to use the http://datatables.net/plug-ins/api#fnSetFilteringDelay. can this puglin be used with Column Fliter plugin together. If yes. except the settings in the example. any other setting is needed? As i did as the example said. it doesn't work..
Many Thanks,
Ruixia
Yes, but the plug-in will only apply itself to the global filter. You would need to modify it if you want it to apply to the column filter elements as well - or integrate it into the column filter program.
Allan
Sorry for the late reply!
I went through the column filter source code and made the following changes, and it worked fine.
function fnCreateInput(regex, smart, bIsNumber) {
.....
FROM
if (bIsNumber && !oTable.fnSettings().oFeatures.bServerSide) {
input.keyup(function () {
/* Filter on the column all numbers that starts with the entered value */
oTable.fnFilter('^' + this.value, index, true, false);
});
} else {
input.keyup(function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter(this.value, index, regex, smart);
});
}
TO
if (bIsNumber && !oTable.fnSettings().oFeatures.bServerSide) {
input.keypress(function (e) { // replace keyup with keypress enter
if (e.which == 13) {
/* Filter on the column all numbers that starts with the entered value */
oTable.fnFilter('^' + this.value, index, true, false);
}
});
} else {
input.keypress(function (e) { // replace keyup with keypress enter
if (e.which == 13) {
/* Filter on the column (the index) of this element */
oTable.fnFilter(this.value, index, regex, smart);
}
});
}
.....
}
Thank you very much for your patience and the great work!:)
Thanks,
Ruixia