> http://example1m.tiddlyspot.com/
I think it's actually a logic error in TableSortingPlugin!!
The following bits of plugin code (in the hijacked version of
refreshTiddler()), are used to locate the desired 'autosort' column...
what is *supposed* to do is set the value of 'x' to the index of the
'autosort' column and then, after looping over all the
'headers' (i.e., the table columns), *if* an autosort column was
found, sorts the table by that column.
-----------------------------
var x = null
...
for (var j=0; j<headers.length; j++){
...
if(!x && hasClass(h,"autosort")) {
x = j;
...
}
}
...
if(x)
c.sortTable(headers[x],rev);
-----------------------------
The problem occurs because the table column index (j) is *zero*
based. That is, the first column of the table has an index of j==0,
the second column has j==1, etc. However, when the "if(x)" is
evaluated, 'null' and '0' are both considered be 'false'. Thus,
autosorting will only occur if the index is > 0 (i.e., any other
column *except* the first one... which is exactly the symptom you
observed.)
The fix is to use a more precise conditional by changing these two
lines:
if(!x && hasClass(h,"autosort")) {
if(x)
to:
if(x===null && hasClass(h,"autosort")) {
if(x!==null)
That should do it.
Note: I've cc'ed Saq (the plugin author) on this, as I'm sure he'll
want to update the official code...
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---