From 1c67a395a9d2fe0ddd2a8265e9d686bdbe3fef06 Mon Sep 17 00:00:00 2001 From: 07lodgeT <50887090+07lodgeT@users.noreply.github.com> Date: Thu, 25 Mar 2021 10:45:31 +0000 Subject: [PATCH 1/3] Dropdown for selecting value in column Using the datatables API, added a dropdown to be able to select a specific value in each column. Useful for getting data for a certain car or track without having to flick through table https://www.datatables.net/examples/api/multi_filter_select.html --- frontend/index.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frontend/index.php b/frontend/index.php index 256f954..fda29fb 100644 --- a/frontend/index.php +++ b/frontend/index.php @@ -113,6 +113,29 @@ $(document).ready( function () { $('#motecData').DataTable({ pageLength: 25 }); } ); + +$(document).ready(function() { + $('#motecData').DataTable( { + initComplete: function () { + this.api().columns().every( function () { + var column = this; + var select = $('') + .appendTo( $(column.footer()).empty() ) + .on( 'change', function () { + var val = $.fn.dataTable.util.escapeRegex( + $(this).val() + ); + column + .search( val ? '^'+val+'$' : '', true, false ) + .draw(); + } ); + column.data().unique().sort().each( function ( d, j ) { + select.append( '' ) + } ); + } ); + } + } ); +} ); $(document).ready(function(){ $('.progress').hide(); From 270285e05760dc95039b9e1d45ca59835345b566 Mon Sep 17 00:00:00 2001 From: 07lodgeT <50887090+07lodgeT@users.noreply.github.com> Date: Thu, 25 Mar 2021 10:50:33 +0000 Subject: [PATCH 2/3] Added column selector into line 120 --- frontend/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/index.php b/frontend/index.php index fda29fb..aff3297 100644 --- a/frontend/index.php +++ b/frontend/index.php @@ -117,7 +117,7 @@ $(document).ready(function() { $('#motecData').DataTable( { initComplete: function () { - this.api().columns().every( function () { + this.api().columns([0, 1]).every( function () { var column = this; var select = $('') .appendTo( $(column.footer()).empty() ) From 5b4783a7699395fcbcc0567a15059c6659e83da1 Mon Sep 17 00:00:00 2001 From: 07lodgeT <50887090+07lodgeT@users.noreply.github.com> Date: Thu, 8 Apr 2021 08:58:03 +0100 Subject: [PATCH 3/3] Update to latest with working JS Can change line 97 to column.footer if wanted filter at the bottom --- frontend/index.php | 148 ++++++++++----------------------------------- 1 file changed, 33 insertions(+), 115 deletions(-) diff --git a/frontend/index.php b/frontend/index.php index aff3297..98a7410 100644 --- a/frontend/index.php +++ b/frontend/index.php @@ -1,18 +1,25 @@ - - + + + ArisDrives Motec Server + + + + + +
-
ArisDrives Motec Server +
ArisDrives Motec Servertrack report

- This is an effort to build an extensive collection of motec data for as many car/track combinations as possible. + This is an effort to build an extensive collection of motec data for as many car/track combinations as possible.

If you would like to contribute, just zip your motec folder and upload it using the button below.
@@ -22,10 +29,18 @@

Select .zip file to upload: - - -
+ + + + + + +
+ + + The table has been refreshed... +
@@ -35,10 +50,10 @@ +

Use the Download button to retrieve the specific ld and ldx in zip format.

@@ -50,48 +65,9 @@ - - -query($query)) { - while ($row = $result->fetch_assoc()) { - $field1name = $row["track"]; - $field2name = $row["car"]; - $field3name = $row["date"]; - $field4name = $row["time"]; - - $whole = intval($row["best_time"]); - $decimal1 = $row["best_time"] - $whole; - $decimal = substr($decimal1, 1, 3); - $field5name = gmdate("i:s", $row["best_time"]) . $decimal; - $field6name = $row["best_lap"]; - $field7name = $row["filename"] . '.ld'; - $field8name = $row["filename"] . '.ldx'; - - echo ' - - - - - - - - - '; - } - $result->free(); -} -?> - @@ -102,33 +78,33 @@ -
Best Laptime Best Lap Motec Download LDX Download
'.$field1name.''.$field2name.''.$field3name.''.$field4name.''.$field5name.''.$field6name.'DownloadDownload
Best Laptime Best Lap Motec Download LDX Download
+ - + +