As a Dr. Frankenstein of coding, I have managed to cobble together a table as exampled [here][1], utilising datatables and UK Date Sorting. The final piece of this puzzle is to find a way to be able to hide an entire row if the date in the corresponding row is older than the current date (i.e. if a date in a td element is older than today's date, hide the row containing that td element).
Is there a js solution to this problem? Any help much appreciated.
Edit: Code as requested:
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.2/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<script>
// UK Date Sorting
jQuery.fn.dataTableExt.oSort['uk_date-asc'] = function(a, b) {
var ukDatea = a.split('/');
var ukDateb = b.split('/');
var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1;
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['uk_date-desc'] = function(a, b) {
var ukDatea = a.split('/');
var ukDateb = b.split('/');
var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1;
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
$(document).ready(function() {
$("#table_id").dataTable({
"aoColumnDefs" : [
{"aTargets" : [2] , "sType" : "uk_date"}
]
});
});
</script>
</head>
<body>
<div class="page-header">
<h2>Heading</h2>
</div>
<div class="table-responsive">
<table id="table_id" class="table table-striped table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Lecture name</th>
<th>Lecturer</th>
<th class="uk-date-column">date</th>
<th>time</th>
<th>link</th>
</tr>
</thead>
<tbody>
<TR>
<TD>Lecture 1</TD>
<TD>Lecturer 1</TD>
<TD>01/10/2014</TD>
<TD ALIGN="RIGHT">11:00</TD>
<TD>Link 1</TD>
</TR>
<TR>
<TD>Lecture 2</TD>
<TD>Lecturer 2</TD>
<TD>02/10/2014</TD>
<TD ALIGN="RIGHT">11:00</TD>
<TD>Link 2</TD>
</TR>
</tbody>
</table>
</div>
</body>
</html>