chifailai2 / jquery-datatables-column-filter

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

WORKAROUND Broken with DataTables v1.9.4 #100

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Just wanted to leave this here... the column filter plugin doesnt appear to be 
working properly with recent versions (tested 1.9.4) of DataTables. Here's the 
fix, just overwrite the mentioned lines with the following code:

line 306:
var fnSearch_ = function (index) {

line 307:
return $("#" + sTableId + "range_from_" + index).val() + 
properties.sRangeSeparator + $("#" + sTableId + "range_to_" + index).val()

line 316:
oTable.fnSettings().fnServerData = function (sSource, aoData, fnCallback, 
oSettings) {

line 323:
aoData[k].value = afnSearch_[j](index);

line 329:
fnServerDataOriginal(sSource, aoData, fnCallback, oSettings);

Original issue reported on code.google.com by kor...@gmail.com on 1 Oct 2012 at 12:19

GoogleCodeExporter commented 8 years ago
thanks a lot for this ! you saved my day :)

Original comment by cha...@gmail.com on 26 Oct 2012 at 3:46

GoogleCodeExporter commented 8 years ago
I've found something about this issue.

I have 2 function. One uses the columnFilter() function and the other doesn't.
If I call the first function first and then the second one the datatables are 
not properly created. this throws me this error: Uncaught Unexpected literal at 
position X. The X could be the numbers 1 or 2.

Original comment by rickardoberdejo on 29 Oct 2012 at 7:38

GoogleCodeExporter commented 8 years ago
I solved it.
in line 170:
var dCellDate = $.datepicker.parseDate($.datepicker.regional[""].dateFormat, 
aData[index]);

I printed in the console the value of aData[index]. When i was using the 
datatables without the plugin this was taking '1.00' as value. then I just 
check if the value of dEndDate in line 168 were a valid date.

var dEndDate = to.datepicker("getDate");
var dCellDate = null;
if((null != dEndDate) && !isNaN(dEndDate) && ("undefined" !== typeof 
dEndDate.getDate)){
   dCellDate = $.datepicker.parseDate("yy/mm/dd", aData[index]);
}

I hope this help someone else.

Original comment by rickardoberdejo on 29 Oct 2012 at 8:42

GoogleCodeExporter commented 8 years ago
Thanks for this! It is lucky I found it instead of wondering what I did wrong 
for no reason.

Original comment by aw...@knightwatch.net on 6 Sep 2013 at 1:18