Link to home
Start Free TrialLog in
Avatar of Bob Schneider
Bob SchneiderFlag for United States of America

asked on

JQuery & Classic ASP

The journey continues...

1) So I am using JQuery DataTable with no server side processing and all is doing fine except that finish times are sorted as text.  I hate to go to server side processing to solve that but maybe I have to?  I don't want the time 1:02:03.45 to show up before 30:45.67 in the results.

2) Can I have a cheat sheet on installing/using aspJSON?  I thought I had to join GitHub but apparently not.  Would using this utility solve my sorting problem?

3) I am also going to need to start passing variables (like RaceID).  Does that require server side processing and/or aspJSON.
SOLUTION
Avatar of James Bilous
James Bilous
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Schneider

ASKER

I time 5ks, triathlons, etc.  I want a results page that loads quickly and allows for searching an individual's own results, sorting results, etc.  I can do that with just classic asp but with large races it can be time consuming (especially for large events) and requires reloading the entire page.

Here is a sample of my current results page

Here is where I am at on the rebuild...miles to go before I sleep...or run...
BTW, the main cause of the excessive load time of the orignal page is collecting the data that you see when you click on someone's  name.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.  I am having a hard time with the render.  If I want to order columns 6, 7, 8 by hh:mm:ss (when clicked on) what would that look like in reference to the script below?

                "render": function ( data, type, row ) {
                    return data +' ('+ row[3]+')';
                },
                "targets": 0
            },
            { "visible": false,  "targets": [ 3 ] }

Open in new window

I believe you can simply render something like

"render": function (data, type, row) {
   return data.getHours() + ":" + data.getMinutes() + ":" + data.getSeconds();
}

Open in new window

Ok I tried that and I get "loading message".  Still trying to figure out how to identify and manage errors.  Does this look problematic syntactically?

<script>
$(document).ready(function() {
    $('#results').DataTable( {
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
        "order": [[ 0, 'asc' ]],
        "columnDefs": [
               { 
                    "type": "date", 
                    "targets": [6,7,8] ,
                    "render": function (data, type, row) {
                       return data.getHours() + ":" + data.getMinutes() + ":" + data.getSeconds();
                    }                
            }
         ],
         "ajax": {"url":"data_source_example.asp?race_id=<%=lRaceID%>"}
    } );
} );
</script>

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I suspect that perhaps the format you are providing your dates in are not parseable by javascripts Date.parse() function which is what DataTables uses behind the scenes to work with / sort by datetime. Does this work without the render function, by simply applying 'date' to your column type?
You could be right but it is pretty standard for the display of running race times.  Regarding just the "date", nope.  I am going to abandon the sort by time question.  Thanks for all your help.