sortable html table results

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

Fortunately you asked an easy follow up question, compared to the ingenious sorting algorithm you have created!

* Global Options / View - check box `Display ranks as'

regards,
Malcolm Osborne
Sedgefield South Africa

···

On 2014/05/20 12:09, 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

------------------------------------------------------------------------
<http://www.avast.com/>

This email is free from viruses and malware because avast! Antivirus <http://www.avast.com/> protection is active.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

As I recall the class attributes are hardwired into the HTML generation
code. But - given that the whole DOM is editable using javascript, add
some javascript before loading your JS utility (i.e. in the Sailwave
template) to add the "sortable" class to tables. I use JQuery and that
would be $('table').addClass('sortable'); dunno what it is in raw
javascript but a bit of googling will find out. Alternatively load JQuery
as well from a hosted source like google.

Cheers,
Colin J

http://sailwave.com

···

On Tue, May 20, 2014 at 11:09 AM, Scott Rickard rickard23@yahoo.com[sailwave] <sailwave@yahoogroups.com> 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

yes - that makes it easy! thanks!

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

Hi Scott et al,

There is an even easier way without having to edit any Sailwave

header.txt file or any other Sailwave file.

Just put a modified copy the sorttable.js file in the javascript

sub-folder of Sailwave or better in a personal directory that you
point to under Golbal Options, so the file does not get deleted when
a full install of Sailwave is done. I can make a suitably modified
file available, which has incorporated Art’s change and the comment
about the comments at the start of the file causing problems.

Kind regards,
Huw
···

On 20/05/2014 21:00, Art Engel
[sailwave] wrote:

artengel123@earthlink.net

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 " and "" lines.

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)

> 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 > ------------------------------------

-!- -!-
-!- -!-
On-Line Sailwave help…http://sailwave.com/help/HTML ~
Mark Townsend’s Sailwave User Guide is available from
~
Convert to daily digest of emails send blank email to
~ To unsubscribe from the
SUG please send blank email to
Yahoo Groups Links



This email is free from viruses and
malware because avast! Antivirus
protection is active.





This email is free from viruses and malware because avast! Antivirus protection is active.

http://www.racingrules.org/sort_test/

rickard23@yahoo.com

http://www.kryogenix.org/code/browser/sorttable/sorttable.js

rickard23@yahoo.com

http://www.yachtsandyachting.com/http://www.sailing.org/http://www.sailwave.com/http://www.abyc.org/upload/Sailwave_ABYC_User_Guide.pdfsailwave-digest@yahoogroups.comsailwave-unsubscribe@yahoogroups.com

This would put ALL of the sorttable.js file into the HTML file (adding
17K to the size of every HTML file that includes the script). My
research shows that putting more than a line or two of javascript into
an HTML file is considered bad practice in terms of both browser
performance (meaning download and display times) and code maintenance.
In general, if you have two web pages that use the same code and the
code is in the HTML file the user will have to download it twice; if the
code is in an external file then it will only be downloaded once and
cached by the browser. [Same for styles, by the way.]

It would definitely be "easier" to buy a new car when your car needed
servicing but it wouldn't be considered "good practice" (I have a friend
whose wife actually did that once!).

My recommendation for good HTML files would be to put your styles into
an external style file and any scripts longer than a line or two into an
external script file. Then, modify the header.txt include-file accordingly.

Art

PS - A minor bug, I think. If I include one script under
Publish>Results>Effects then it works and the script is included in the
HTML file. If I include two scripts, which seems to be allowed, then
neither is included. I don't use scripts with Sailwave so this is the
first time I've noticed this - I tried several scripts together and it
doesn't seem to be related to the scripts but the number of them.

···

On 5/21/2014 11:34 AM, Huw Pearce huw.pearce@bcs.org.uk [sailwave] wrote:

Hi Scott et al,

There is an even easier way without having to edit any Sailwave
header.txt file or any other Sailwave file.

Just put a modified copy the sorttable.js file in the javascript
sub-folder of Sailwave or better in a personal directory that you point
to under Golbal Options, so the file does not get deleted when a full
install of Sailwave is done. I can make a suitably modified file
available, which has incorporated Art's change and the comment about the
comments at the start of the file causing problems.

Kind regards,
Huw
On 20/05/2014 21:00, Art Engel artengel123@earthlink.net [sailwave] wrote:

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.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Art,

Thanks for the information and I agree that reducing bandwidth

consumption is good.

My solution works for those who can't get files other than HTML

loaded to a web server.

I will talk to Jon about putting in the HTML  just script link not

full code.

Kind regards,
Huw
···

On 21/05/2014 20:50, Art Engel
[sailwave] wrote:

artengel123@earthlink.net

          This would put ALL of the sorttable.js file into the HTML

file (adding
17K to the size of every HTML file that includes the
script). My
research shows that putting more than a line or two of
javascript into
an HTML file is considered bad practice in terms of both
browser
performance (meaning download and display times) and code
maintenance.
In general, if you have two web pages that use the same
code and the
code is in the HTML file the user will have to download it
twice; if the
code is in an external file then it will only be
downloaded once and
cached by the browser. [Same for styles, by the way.]

          It would definitely be "easier" to buy a new car when your

car needed
servicing but it wouldn’t be considered “good practice” (I
have a friend
whose wife actually did that once!).

          My recommendation for good HTML files would be to put your

styles into
an external style file and any scripts longer than a line
or two into an
external script file. Then, modify the header.txt
include-file accordingly.

          Art

          PS - A minor bug, I think. If I include one script under
          Publish|Results|Effects then it works and the script is

included in the
HTML file. If I include two scripts, which seems to be
allowed, then
neither is included. I don’t use scripts with Sailwave so
this is the
first time I’ve noticed this - I tried several scripts
together and it
doesn’t seem to be related to the scripts but the number
of them.

          On 5/21/2014 11:34 AM, Huw Pearce [sailwave] wrote:

Hi Scott et al,

There is an even easier way without having to edit
any Sailwave > header.txt file or any other Sailwave file.

Just put a modified copy the sorttable.js file in the
javascript > sub-folder of Sailwave or better in a personal
directory that you point > to under Golbal Options, so the file does not get
deleted when a full > install of Sailwave is done. I can make a suitably
modified file > available, which has incorporated Art’s change and
the comment about the > comments at the start of the file causing problems.

Kind regards,
Huw
On 20/05/2014 21:00, Art Engel
[sailwave] wrote:

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 ” and
“” lines.

<script

src=“sorttable.js”>

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

-!- -!-
-!- -!- On-Line Sailwave
help…http://sailwave.com/help/HTML ~ Mark
Townsend’s Sailwave User >> Guide is available from >>
~
Convert to >> daily digest of emails send blank email to >> ~ To unsubscribe
from the SUG please >> send blank email to
Yahoo Groups >> Links


This email is free from viruses and malware
because avast! Antivirus >> protection is
active.


This email is free from viruses and malware because
avast! Antivirus protection is active.



This email is free from viruses and
malware because avast! Antivirus
protection is active.





This email is free from viruses and malware because avast! Antivirus protection is active.

huw.pearce@bcs.org.uk

artengel123@earthlink.net

http://www.racingrules.org/sort_test/

rickard23@yahoo.com

http://www.kryogenix.org/code/browser/sorttable/sorttable.js

rickard23@yahoo.com

http://www.yachtsandyachting.com/http://www.sailing.org/
http://www.sailwave.com/

http://www.abyc.org/upload/Sailwave_ABYC_User_Guide.pdf

sailwave-digest@yahoogroups.com
sailwave-unsubscribe@yahoogroups.com

http://www.avast.com/

http://www.avast.com/

http://www.avast.com

Huw,

I admit that I hadn't considered folks not having access to their
webserver. I guess I assumed that if the head scorer had the username
and password to put into Sailwave they would also have the ability to
use FTP but, of course, some users won't be web savvy.

I don't think there is any reason to bother Jon. The script and style
file links can be put into the header.txt file and then work just fine.
If a user is sophisticated enough to know what an HTML file is then they
probably are sophisticated enough to edit the header.txt file and upload
the ancillary files via FTP. A simple help page on the website would
probably be more than sufficient for those purposes.

Art

···

On 5/21/2014 1:19 PM, Huw Pearce huw.pearce@bcs.org.uk [sailwave] wrote:

Art,

Thanks for the information and I agree that reducing bandwidth
consumption is good.

My solution works for those who can't get files other than HTML loaded
to a web server.

I will talk to Jon about putting in the HTML just script link not full
code.

Kind regards,
Huw
On 21/05/2014 20:50, Art Engel artengel123@earthlink.net [sailwave] wrote:

This would put ALL of the sorttable.js file into the HTML file (adding
17K to the size of every HTML file that includes the script). My
research shows that putting more than a line or two of javascript into
an HTML file is considered bad practice in terms of both browser
performance (meaning download and display times) and code maintenance.
In general, if you have two web pages that use the same code and the
code is in the HTML file the user will have to download it twice; if the
code is in an external file then it will only be downloaded once and
cached by the browser. [Same for styles, by the way.]

It would definitely be "easier" to buy a new car when your car needed
servicing but it wouldn't be considered "good practice" (I have a friend
whose wife actually did that once!).

My recommendation for good HTML files would be to put your styles into
an external style file and any scripts longer than a line or two into an
external script file. Then, modify the header.txt include-file
accordingly.

Art

PS - A minor bug, I think. If I include one script under
Publish>Results>Effects then it works and the script is included in the
HTML file. If I include two scripts, which seems to be allowed, then
neither is included. I don't use scripts with Sailwave so this is the
first time I've noticed this - I tried several scripts together and it
doesn't seem to be related to the scripts but the number of them.

On 5/21/2014 11:34 AM, Huw Pearce huw.pearce@bcs.org.uk [sailwave] wrote:

Hi Scott et al,

There is an even easier way without having to edit any Sailwave
header.txt file or any other Sailwave file.

Just put a modified copy the sorttable.js file in the javascript
sub-folder of Sailwave or better in a personal directory that you point
to under Golbal Options, so the file does not get deleted when a full
install of Sailwave is done. I can make a suitably modified file
available, which has incorporated Art's change and the comment about

the

comments at the start of the file causing problems.

Kind regards,
Huw
On 20/05/2014 21:00, Art Engel artengel123@earthlink.net [sailwave] >> wrote:

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.

---
This email is free from viruses and malware because avast! Antivirus

protection is active.

http://www.avast.com

------------------------------------------------------------------------
<http://www.avast.com/>

This email is free from viruses and malware because avast! Antivirus
<http://www.avast.com/> protection is active.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com