Modify JSON, LocalStorage and feed into DataTable Plugin
Modify JSON, LocalStorage and return new Json into DataTables having removed date related variants ~ Andrew Pougher
by Sreekesh S K
HTML
<script src="http://datatables.net/release-datatables/media/js/jquery.dataTables.js"></script>
<link rel="stylesheet" href="http://datatables.net/release-datatables/media/css/demo_table.css">
<span id="msg"></span><input type="text" placeholder="21-07-2011" id="fm" value="21-07-2011"/> - <input type="text" placeholder="21-07-2012" id="to" value="21-07-2012"/> <br>
<div id='new'></div><br>
<h1>Travel data</h1>
<table cellpadding="0" cellspacing="0" border="0" class="dataTable" id="example">
<thead>
<tr>
<th>details</th>
<th>names</th>
<th>agy ref</th>
<th>departing</th>
<th>returning</th>
<th>Destin'</th>
<th>flight</th>
<th>hotel</th>
<th>car</th>
<th>Air status</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
CSS
body{padding:12px;}
span{color:#28c3d5;display:block}
input{padding:4px}
#example{font-size:11px}
#new{font-size:10px;height:140px;overflow:auto;border:1px solid #444}
JavaScript
var locations = [{
"AirStatus": "HELD",
"AirStatusToolTip": "This is the text that should appear as tooltip over the word HELD",
"ExternalItinLink": "",
"Flights": [
],
"FullPNRKey": "1S.X55F.RRRRRR",
"NavitasAcctNum": null,
"NumCar": 1,
"NumFlight": 0,
"NumHotel": 0,
"Passengers": [
{
"FullName": "SABRE/RRRRRR",
"FullPNRKey": "1S.X55F.JVZCVV"}
],
"RecordLocator": "RRRRRR",
"Routing": "LON",
"RoutingDecoded": "LON-London, (GB)",
"TripEndDate": "Friday, July 27, 2012",
"TripStartDate": "Wednesday, July 25, 2012",
"WaitlistExists": false},
{
"AirStatus": "HELD",
"AirStatusToolTip": "This is the text that should appear as tooltip over the word HELD",
"ExternalItinLink": "",
"Flights": [],
"FullPNRKey": "1S.X55F.FYUDAR",
"NavitasAcctNum": null,
"NumCar": 0,
"NumFlight": 0,
"NumHotel": 1,
"Passengers": [{
"FullName": "SABRE/ANOTHER",
"FullPNRKey": "1S.X55F.FYUDAR"}],
"RecordLocator": "FYUDAR",
"Routing": "JFK",
"RoutingDecoded": "JFK-John F Kennedy Intl, (US)<br/>",
"TripEndDate": "Sunday, July 08, 2012",
"TripStartDate": "Saturday, July 07, 2012",
"WaitlistExists": false},
{
"AirStatus": "HELD",
"AirStatusToolTip": "This is the text that should appear as tooltip over the word HELD",
"ExternalItinLink": "",
"Flights": [],
"FullPNRKey": "1S.X55F.JUCSUO",
"NavitasAcctNum": null,
"NumCar": 1,
"NumFlight": 0,
"NumHotel": 0,
"Passengers": [{
"FullName": "SABRE/EMMA",
"FullPNRKey": "1S.X55F.JUCSUO"}],
"RecordLocator": "JUCSUO",
"Routing": "MAN",
"RoutingDecoded": "MAN-Manchester Intl, (GB)<br/>",
"TripEndDate": "Thursday, July 12, 2012",
"TripStartDate": "Tuesday, July 10, 2012",
"WaitlistExists": false},
{
"AirStatus": "HELD",
"AirStatusToolTip": "This is the text that should appear as...