Hi Mike
Thanks for the hint..
I understand that I should write sth like (I know this is wrong
- ....:
var out=[];
var fmt='| %0 | %1 | %2 | %3 |';
for (var i=0; i<tids.length; i++) {
var val1=tids[i].title; if (2!=t.modifier)
var val2=t.modifier;
var val3=t.modified.formatString ('YYYY.0MM.0DD-DDD 0hh:0mm:0ss')+"
|"+'');
var hdr="|sortable|k\n| !Tiddler | !Modifier | !Modified|h"
out.push(hdr);
I know next script isn't right - but it is nevertheless usefull even
if made wrong - :
(It sorts Modifier and TiddlerTitles in the same column)
I think: If I could separate tiddlertitle t.modifier and t.modified
(in three parts/columns instead of two )- Then I would have a correct
sortable table
<script>
var out= ['| Script by Shulman, Mårtensson & Gray|c'];
var hdr="|sortable|k\n| !Tiddler&Modifier | !Modified |h"
out.push(hdr);
var who='';
var tids=store.getTiddlers('modifier');
for (i=0; i<tids.length; i++) { var t=tids[i];
if (who!=t.modifier) {
who=t.modifier;
out.push('| modified by @@"""'+who+'""":@@ |
\>|');
}
out.push('|[['+t.title+']]|'+t.modified.formatString
('YYYY.0MM.0DD-DDD 0hh:0mm:0ss')+" |"+'');
}
return out.join('\n');
</script>
Can you help me out?
YS Måns Mårtensson
On 10 Nov., 22:44, Mike <[email protected]> wrote:
> With some help from ELS I have replaced all of my fET calls to inline
> JS :)
> I think you are missing the header (hdr)
> i.e.
> var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By | !
> Purchased ||h"
> out.push(hdr);
>
> A Working Example:
> <script>
> var out=[];
> var fmt='| %0 | %1 | %2 | %3 | %4 | {{fine{[[%5|%5]]}}} |';
> var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && !
> Trash","created");
> var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By
> | !Purchased ||h"
>
> out.push(hdr);
> if (!tids.length) out=["No Cigars found"];
>
> for (var i=0; i<tids.length; i++) {
> var val1=tids[i].title;
> if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated")
> continue;
> if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
> var val2=store.getTiddlerSlice(val1,'Brand')
> var val3=store.getTiddlerSlice(val1,'Name')
> var val4=store.getTiddlerSlice(val1,'Wrapper')
> var val5=store.getTiddlerSlice(val1,'RecommendedBy')
> var val6=store.getTiddlerSlice(val1,'Purchased')
> out.push(fmt.format([val2,val3,val4,val5,val6,val1]));
> }
> return out.join('\n');
> </script>
>
> On Nov 10, 3:19 pm, Måns <[email protected]> wrote:
>
>
>
> > Very neat Morris
>
> > On 10 Nov., 14:07, Morris Gray <[email protected]> wrote:
>
> > > My last submission ;-) Next....
>
> > One question though - Is it necessary to change it into a fET to make
> > use of TablesortingPlugin (http://tw.lewcid.org/#TableSortingPlugin)
> > or is it possible to make the table sortable within the script?
>
> > YS Måns Mårtensson
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---