Scott,
Here is still another method to get what you want. It might be simpler
than the other methods suggested as it leaves the Sailwave output alone
except for the addition of the <script> reference. Plus, it uses most of
what you've already done.
As an alternative to your step three you can edit the sorttable.js file.
The js file invokes its functions only for the "sortable" class. You can
just change the js file to use a different class trigger.
At line 35 of the js file you will see:
+++++
if (table.className.search(/\bsortable\b/) != -1) {
+++++
That is the single line that does the triggering.
Simply change "bsortable" to "bsummary table" (or whatever class you
want to be sortable). That will invoke the functions for the class
"summary table" instead of the class "sortable". For HTML files that
don't include the script then the functions cannot be invoked and so
will be ignored for the "summary table" class in those files (those that
don't include the script reference). Presumably, you could invoke for
multiple classes (and different HTML files) but I don't know whether
that would require multiple js files or whether you could do it all in
one js file. I think the latter might work but you'd have to experiment.
I made a working example here:
http://www.racingrules.org/sort_test/
I modified the header.txt file as you suggested and edited the
sorttable.js file, as suggested above, to provide sorting for both
"summarytable" and "racetable" classes.
PRO: probably smallest HTML files since I replaced the <script>
javascript.html with the <script> alternative you specified. You could
include both although the <script> javascript.html does nothing if you
aren't using it.
CON: the js file needs to exist for sorting to work, BUT the file looks
just fine if the js file is missing so excluding the js file won't break
the file.
Art
PS - I verified using the class "summary table" as that is what you
specified. In fact, I think the correct class name used by Sailwave is
"summarytable"; I used "racetable" in the example.
On 5/20/2014 3:09 AM, Scott Rickard rickard23@yahoo.com [sailwave] wrote:
Hi,
I wish to output the results in a sortable table so that one can
simple click the column heading when viewing the results and the
results table will sort by that column's entries.
This requires three changes to the configuration, two of which I can
do - but one I cannot figure out how to do.
Step one: add this .js file
http://www.kryogenix.org/code/browser/sorttable/sorttable.js to the
web folder where the results will uploaded.
Step two: add the below line to the Sailwave/Templatesheader.txt
file between in the "</script>" and "</head>" lines.
<script src="sorttable.js"></script>
Step three: Change the html results file so that the line which has
<table class="summary table" ...
is changed to read (and yes, just one "t" in sortable)
<table class="summarytable sortable" ....
And then the published results should be sortable by clicking on the
column heading.
Some notes:
Alternatively, you can add the js file to the sailwave javascript
folder and, then, when publishing results, select the "Effect"
sorttable (and yes, that's two "t"s in sorttable). In this case - you
can skip step 1 and 2 above (as the javascript will be included in the
results html file). One thing I noticed is that there is a comment at
the beginning of the js file which has a " in it which can cause
problems - if you just remove the lines with the "'s in them from the
comment in the top of the js file (lines 9 and 10), everything works
fine. If you don't, the " can be interpreted as the end of the comment
and you'll see some garbage at the top of the results html file when
viewing in a browser. This is not a problem is you do the three steps
above.
So my question is, is there a way of getting sailwave to output
<table class="summarytable sortable" ....
instead of
<table class="summary table" ...
when outputing results to the web?
And then, as a follow-on question - if you do the above, and you
sort the results by something other than the rank when viewing them,
and you want to view then in place order again, then you have to
reload the page as the sorting sorts in dictionary order 10th,11th,
... 19th, 1st, 2nd, ... instead of understanding that these are number
and 1st should come before 10th - so my question is, how do you change
the output format for the Rank so that it is 1, 2, 3 and not 1st, 2nd 3rd?
Thanks,
-scott
------------------------------------
Posted by: Scott Rickard <rickard23@yahoo.com>
------------------------------------
-!- http://www.yachtsandyachting.com/ -!- http://www.sailing.org/
-!- http://www.sailwave.com/ -!- On-Line Sailwave
help...http://sailwave.com/help/HTML ~ Mark Townsend's Sailwave User
Guide is available from
http://www.abyc.org/upload/Sailwave_ABYC_User_Guide.pdf ~ Convert to
daily digest of emails send blank email to
sailwave-digest@yahoogroups.com ~ To unsubscribe from the SUG please
send blank email to sailwave-unsubscribe@yahoogroups.com Yahoo Groups
Links
------------------------------------------------------------------------
<http://www.avast.com/>
This email is free from viruses and malware because avast! Antivirus
<http://www.avast.com/> protection is active.