Closed GoogleCodeExporter closed 9 years ago
Same issue here plus pagination produces this issue, so when I go to the next
page all rows disappear.
I'm using server-side processing.
JQuery: 1.7.1
DataTables: 1.9.2
ColumnFilter: 1.4.8
Original comment by arnold.l...@gmail.com
on 14 Jul 2012 at 8:45
Hi,
It works fine on
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/numberRange.html
Could you send me some online example?
Thanks,
Jovan
Original comment by joc...@gmail.com
on 15 Jul 2012 at 11:41
Further investigation has revealed the cause in my case.
The data in the table was wrapped in span tags, causing problems in
oTable.dataTableExt.afnFiltering.push
My fix was to add:
aData[_fnColumnIndex(index)] =
aData[_fnColumnIndex(index)].replace("<span>","");
aData[_fnColumnIndex(index)] = aData[_fnColumnIndex(index)].replace("</span>",
"");
after:
var iMax = document.getElementById(sToId).value * 1;
in that function
Original comment by robert.h...@iesve.com
on 18 Jul 2012 at 9:43
Thanks for help.
I figured out that my problem was I didn't parse the range input for server
side processing.
So the query looked like: ....LIKE '%s~s%'
In the server-side processing script i added:
/* Individual column filtering */
for ( $i=0 ; $i<count($aColumns) ; $i++ )
{
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
{
if ( $sWhere == "" )
{
$sWhere = "WHERE ";
}
else
{
$sWhere .= " AND ";
}
//$sWhere .= "".$cColumns[$i]." LIKE '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
$columnFilterValue = mysql_real_escape_string($_GET['sSearch_' . $i]);
// check for values range
$rangeSeparator = "~";
if (!empty($rangeSeparator) && strstr($columnFilterValue, $rangeSeparator)) {
// get min and max
$columnFilterRangeMatches = explode('~', $columnFilterValue);
// get filter
if (empty($columnFilterRangeMatches[0]) && empty($columnFilterRangeMatches[1]))
$sWhere .= " 0 = 0 ";
else if (!empty($columnFilterRangeMatches[0]) && !empty($columnFilterRangeMatches[1]))
$sWhere .= $cColumns[$i] . " BETWEEN '" . $columnFilterRangeMatches[0] . "' and '" . $columnFilterRangeMatches[1] . "' ";
else if (empty($columnFilterRangeMatches[0]) && !empty($columnFilterRangeMatches[1]))
$sWhere .= $cColumns[$i] . " <= '" . $columnFilterRangeMatches[1] . "' ";
else if (!empty($columnFilterRangeMatches[0]) && empty($columnFilterRangeMatches[1]))
$sWhere .= $cColumns[$i] . " >= '" . $columnFilterRangeMatches[0] . "' ";
} else {
$sWhere .= $aColumns[$i] . " LIKE '%" . $columnFilterValue . "%' ";
}
}
}
and the range-filter is working :)
Original comment by arnold.l...@gmail.com
on 18 Jul 2012 at 10:11
Hi,
I will assume that this issue can be closed.
1. number range forks only with numbers so make sure that you do not use span
tags. I cannot handle all possible design choices in filter.
2. Second issue is reasolved as I see.
Thanks,
Jovan
Original comment by joc...@gmail.com
on 4 Sep 2012 at 8:08
Original issue reported on code.google.com by
robert.h...@iesve.com
on 6 Jun 2012 at 10:54