daterange date picker not working with my sever side code
daterange date picker not working with my sever side code
ssoosi
Posts: 4Questions: 0Answers: 0
My daterange does not work with daatables ,
Any help please............
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
Created using /
Source can be edited via /ilofuv/3/edit
-->
@import "/media/css/demo_page.css";
@import "/media/css/demo_table_jui.css";
Min date:
Max date:
id
Promo
datesubbed
<?php
$username="root";
$password="";
$database="carsubexporter";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * from carsubs2 ORDER BY datesubbed DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "Database Output
";
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$promoid=mysql_result($result,$i,"promoid");
$datesubbed=mysql_result($result,$i,"datesubbed");
?>
<?php echo $id; ?>
<?php echo $promoid; ?>
<?php echo $datesubbed; ?>
<?php
$i++;
}
?>
var minDateFilter;
var maxDateFilter;
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
if ( typeof aData._date == 'undefined' ) {
aData._date = new Date(aData[1]).getTime();
}
if ( minDateFilter && !isNaN(minDateFilter) ) {
if ( aData._date < minDateFilter ) {
return false;
}
}
if ( maxDateFilter && !isNaN(maxDateFilter) ) {
if ( aData._date > maxDateFilter ) {
return false;
}
}
return true;
}
);
$(document).ready( function() {
var oTable = $('#example').dataTable( {
"bJQueryUI": true
} );
$( "#datepicker_min" ).datepicker ( {
dateFormat: 'yy-mm-dd',
"onSelect": function(date) {
minDateFilter = new Date(date).getTime();
oTable.fnDraw();
}
} ).keyup( function () {
minDateFilter = new Date(this.value).getTime();
oTable.fnDraw();
} );
$( "#datepicker_max" ).datepicker( {
dateFormat: 'yy-mm-dd',
"onSelect": function(date) {
maxDateFilter = new Date(date).getTime();
oTable.fnDraw();
}
} ).keyup( function () {
maxDateFilter = new Date(this.value).getTime();
oTable.fnDraw();
} );
} );
[/code]
Any help please............
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
Created using /
Source can be edited via /ilofuv/3/edit
-->
@import "/media/css/demo_page.css";
@import "/media/css/demo_table_jui.css";
Min date:
Max date:
id
Promo
datesubbed
<?php
$username="root";
$password="";
$database="carsubexporter";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * from carsubs2 ORDER BY datesubbed DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "Database Output
";
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$promoid=mysql_result($result,$i,"promoid");
$datesubbed=mysql_result($result,$i,"datesubbed");
?>
<?php echo $id; ?>
<?php echo $promoid; ?>
<?php echo $datesubbed; ?>
<?php
$i++;
}
?>
var minDateFilter;
var maxDateFilter;
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
if ( typeof aData._date == 'undefined' ) {
aData._date = new Date(aData[1]).getTime();
}
if ( minDateFilter && !isNaN(minDateFilter) ) {
if ( aData._date < minDateFilter ) {
return false;
}
}
if ( maxDateFilter && !isNaN(maxDateFilter) ) {
if ( aData._date > maxDateFilter ) {
return false;
}
}
return true;
}
);
$(document).ready( function() {
var oTable = $('#example').dataTable( {
"bJQueryUI": true
} );
$( "#datepicker_min" ).datepicker ( {
dateFormat: 'yy-mm-dd',
"onSelect": function(date) {
minDateFilter = new Date(date).getTime();
oTable.fnDraw();
}
} ).keyup( function () {
minDateFilter = new Date(this.value).getTime();
oTable.fnDraw();
} );
$( "#datepicker_max" ).datepicker( {
dateFormat: 'yy-mm-dd',
"onSelect": function(date) {
maxDateFilter = new Date(date).getTime();
oTable.fnDraw();
}
} ).keyup( function () {
maxDateFilter = new Date(this.value).getTime();
oTable.fnDraw();
} );
} );
[/code]
This discussion has been closed.