Multiple filter Boxes, numbers range,

Multiple filter Boxes, numbers range,

deckoffdeckoff Posts: 11Questions: 0Answers: 0
edited March 2014 in General
OK. I know that this question has been asked not once, and I read a lot.
This a database that logs sport bets.
What I want - I want to the filters to stack - so I can search all bets at odds 1.5 - 2.1 for a date range, for bets with amount 10 -20 (for example)
The filters now work - I can apply date range, odds or bet amount. But if I apply two at the same time, the first will clear the second (date filter overrides all, so if a bet falls within the given date range, it will be shown, even if the amount placed was 9)

Here is a link to the page

http://testbet.hostingsiteforfree.com/

Please, use
user:
rugby
pass:
1234

Couldnt thing of a safer pass

To access filter fileds - go to Tipster-stats (top middle) and select filters tab in dialog (middle)

As I said, filters work on their own, but not toghether
Here is the code of
[code] fn.dataTableExt.afnFiltering.push[/code]

[code]
$.fn.dataTableExt.afnFiltering.push(

function( oSettings, aData, iDataIndex )
{

var minDate = $('#minDate').val();
var maxDate = $('#maxDate').val();
var minPrice = $('#minPrice').val();
var maxPrice = $('#maxPrice').val();
maxPrice = maxPrice*1
minPrice = minPrice*1
var unitMinTipster = $('#unitMinTipster').val();
var unitMaxTipster = $('#unitMaxTipster').val();
unitMinTipster = unitMinTipster*1
unitMaxTipster = unitMaxTipster*1

// if ( minDate != "" || maxDate != "" )
{
console.log("minDate:",minDate,"maxDate:",maxDate)

var dateColumn = 1; // <-- Find a Date Range on the End Date Column

// Strip out the dd, mmm and yyyy date strings from the input text box date. Get
// the two digit int value of the 'mmm' month. Re-arrange to form a string in
// the form yyyymmdd and then convert to an integer for easy mathematical comparison

minDate=minDate.substring(0,4)+minDate.substring(5,7)+minDate.substring(8,10);
minDate=minDate*1
maxDate=maxDate.substring(0,4)+maxDate.substring(5,7)+maxDate.substring(8,10);
maxDate=maxDate*1

// This function is called for each row in the table. Get this rows date from the
// End_Ts Date column and call getCellData() to strip out the elements inside the s


var colDate = aData[dateColumn];

// console.log(colDate)
// Remove the time stamp out of the columns date
// E.g --> 06-Mar-2011 23:45:46 --> 06-Mar-2011

// colDate = colDate.substring(0,11);

// Convert the column date into an integer as above
colDate=colDate.substring(0,4)+colDate.substring(5,7)+colDate.substring(8,10);
colDate=colDate*1

// Compare the text box min and max dates with the column date in this row.
// Return true means: Make the row with this column date visible in the dataTable.
// If the date text boxes are empty then, due to code above, their values will now be 000.


if ( minDate == "" && maxDate == "" )
{
return true;
}
else if ( minDate <= colDate && maxDate == "")
{
return true;
}
else if ( maxDate >= colDate && minDate == "")
{
return true;
}
else if (minDate <= colDate && maxDate >= colDate)
{
return true;
}
return false;
}

if ( minPrice != "" || maxPrice != "" )
{

console.log("minPrice:",minPrice,"maxPrice:",maxPrice)
var dateColumn = 3;

var colDate = aData[dateColumn];
maxPrice = maxPrice*1
minPrice = minPrice*1

colDate = colDate*1

// console.log ("minPrice:", minPrice, "maxPrice:", maxPrice)

if ( minPrice == "" && maxPrice == "" )
{
return true;
}
else if ( minPrice == "" && colDate < maxPrice )
{
return true;
}
else if ( minPrice < colDate && "" == maxPrice )
{
return true;
}
else if ( minPrice < colDate && colDate < maxPrice )
{
return true;
}
return false;
}

// filter by tipsterStake



if ( unitMinTipster != "" || unitMaxTipster != "" )
{
// console.log("unitMinTipster:",unitMinTipster)

var colDate = aData[4];

colDate = colDate*1

console.log("unitMinTipster:",unitMinTipster,"unitMaxTipster:",unitMaxTipster)

if ( unitMinTipster == "" && unitMaxTipster == "" )
{
return true;
}
else if ( unitMinTipster == "" && colDate < unitMaxTipster )
{
return true;
}
else if ( unitMinTipster < colDate && "" == unitMaxTipster )
{
return true;
}
else if ( unitMinTipster < colDate && colDate < unitMaxTipster )
{
return true;
}
return false;
}
return true
}
);
[/code]
This discussion has been closed.