[tw] Re: need help using variables and custom fields in pagewise FET
Eric, Using your sample as is, with the parseInt fix, makes the buttons won't do anything when clicked. I've checked the error console and no error listed. However, this code is behaving strangely: function getHeader(context,count) { if (!window.fetStartIndex || window.fetStartIndex 0) window.fetStartIndex = 0; // ensure not to page behind the last page if (window.fetStartIndex = count) window.fetStartIndex = Math.min(Math.max(window.fetStartIndex-window.fetItemsPerPage,0),count-1); createTiddlyButton(context.place,,null, function(e) { // modified according to https://groups.google.com/forum/#!topic/tiddlywiki/0Q3zVhGK7Os var c = parseInt(store.getValue(tiddler,local_count)) - window.fetItemsPerPage; store.setValue(tiddler.title,local_count,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); createTiddlyButton(context.place,,null, function(e) { // modified according to https://groups.google.com/forum/#!topic/tiddlywiki/0Q3zVhGK7Os var c = parseInt(store.getValue(tiddler,local_count)) + window.fetItemsPerPage; store.setValue(tiddler.title,local_count,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); var startNo = window.fetStartIndex+1; var endNo = Math.min(count,window.fetStartIndex+window.fetItemsPerPage); return (+startNo+ - +endNo+ of + count + items)\n{{clear{\n}}}; } The buttons will change page only after clicking on them several times. Sometimes 4 clicks is necessary to change page, sometimes 2, and so on. Do you know what's going on? On Monday, March 9, 2009 7:32:51 AM UTC+7, Eric Shulman wrote: script var CountValue = store.getValue(tiddler, VerseCount); /script * This actually creates another global variable, window.CountValue, which isn't really necessary since store.getValue() can be called later on, in response to pressing the or buttons (see suggested code changes below). * Custom field names must be *all lower case* (due a known limitation in the core). Thus, you have to use versecount or verse_count or just vc, instead of VerseCount. So, eliminate the global entirely, and then write the 'button' code to look something like this: createTiddlyButton(context.place,,null, function(e) { var c=store.getValue(tiddler,vc)-window.fetItemsPerPage; store.setValue(tiddler.title,versecount,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); createTiddlyButton(context.place,,null, function(e) { var c=store.getValue(tiddler,vc)+window.fetItemsPerPage; store.setValue(tiddler.title,versecount,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); (note: untested code) enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: need help using variables and custom fields in pagewise FET
I've tried this in a more resent version (2.7.1) but can't make it work. I get 'tiddler.title' is null or not an objekt. Would anyone care to test my testTW at https://dl.dropboxusercontent.com/u/955759/empty.html? /Magnus -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: need help using variables and custom fields in pagewise FET
It doesn't do anything now when you click on the buttons :-( Actually, it does do something... it causes a program error! Look at the ToolsError Console (you may have to scroll to bottom). You should see an error that says: parseint is not defined I'm certain I put exactly what you said. not *exactly*... I wrote: parseInt(...), you wrote parseint(...). Javascript functions and variable names are *case-sensitive*. -e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: need help using variables and custom fields in pagewise FET
Thanks for your patience Eric, It works now... I swear I looked at the two side-by-side ten times! But my wife would attest that I'm not good at finding things right in front of me :-) Dave On Mar 9, 12:17 am, Eric Shulman elsdes...@gmail.com wrote: It doesn't do anything now when you click on the buttons :-( Actually, it does do something... it causes a program error! Look at the ToolsError Console (you may have to scroll to bottom). You should see an error that says: parseint is not defined I'm certain I put exactly what you said. not *exactly*... I wrote: parseInt(...), you wrote parseint(...). Javascript functions and variable names are *case-sensitive*. -e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: need help using variables and custom fields in pagewise FET
script var CountValue = store.getValue(tiddler, VerseCount); /script * This actually creates another global variable, window.CountValue, which isn't really necessary since store.getValue() can be called later on, in response to pressing the or buttons (see suggested code changes below). * Custom field names must be *all lower case* (due a known limitation in the core). Thus, you have to use versecount or verse_count or just vc, instead of VerseCount. So, eliminate the global entirely, and then write the 'button' code to look something like this: createTiddlyButton(context.place,,null, function(e) { var c=store.getValue(tiddler,vc)-window.fetItemsPerPage; store.setValue(tiddler.title,versecount,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); createTiddlyButton(context.place,,null, function(e) { var c=store.getValue(tiddler,vc)+window.fetItemsPerPage; store.setValue(tiddler.title,versecount,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); (note: untested 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 TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: need help using variables and custom fields in pagewise FET
Thank you Eric for explaining that about the global variables and the fact that fields have to all be lower case. Your code does kind of work, but its adding as text, not as math, e.g. if I start with versecount of 0, then press the button, the versecount (and thus the window.fetStartIndex) becomes 015, then 01515. Is there a way to indicate that it should all be in math? Thanks for your help, -Dave On Mar 8, 6:32 pm, Eric Shulman elsdes...@gmail.com wrote: script var CountValue = store.getValue(tiddler, VerseCount); /script * This actually creates another global variable, window.CountValue, which isn't really necessary since store.getValue() can be called later on, in response to pressing the or buttons (see suggested code changes below). * Custom field names must be *all lower case* (due a known limitation in the core). Thus, you have to use versecount or verse_count or just vc, instead of VerseCount. So, eliminate the global entirely, and then write the 'button' code to look something like this: createTiddlyButton(context.place,,null, function(e) { var c=store.getValue(tiddler,vc)-window.fetItemsPerPage; store.setValue(tiddler.title,versecount,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); createTiddlyButton(context.place,,null, function(e) { var c=store.getValue(tiddler,vc)+window.fetItemsPerPage; store.setValue(tiddler.title,versecount,c); window.fetStartIndex = c; story.refreshTiddler(context.viewerTiddler.title,null,true); }); (note: untested 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 TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: need help using variables and custom fields in pagewise FET
Your code does kind of work, but its adding as text, not as math, e.g. if I start with versecount of 0, then press the button, the versecount (and thus the window.fetStartIndex) becomes 015, then 01515. oops! to convert the retrieved text into a number, use the parseInt (...) function, like this: var c=parseInt(store.getValue(tiddler,vc))- window.fetItemsPerPage; -e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: need help using variables and custom fields in pagewise FET
I'm being a pest, but would you mind looking at it? Its at www.worldenglishbible.tiddlyspot.com and you just go to Matthew in the list of books (no permalink in Firefox) It doesn't do anything now when you click on the buttons :-( I'm certain I put exactly what you said. And sorry, it takes a while to load (6.7 M - I'm afraid by the time I finish this it'll need a really fast computer to run it) Thanks Eric -Dave On Mar 8, 10:34 pm, Eric Shulman elsdes...@gmail.com wrote: Your code does kind of work, but its adding as text, not as math, e.g. if I start with versecount of 0, then press the button, the versecount (and thus the window.fetStartIndex) becomes 015, then 01515. oops! to convert the retrieved text into a number, use the parseInt (...) function, like this: var c=parseInt(store.getValue(tiddler,vc))- window.fetItemsPerPage; -e --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~--~~~~--~~--~--~---
[tw] Re: need help using variables and custom fields in pagewise FET
oops, I mean http://worldenglishbible.tiddlyspot.com/ On Mar 8, 11:38 pm, Dave Parker cedar...@telus.net wrote: I'm being a pest, but would you mind looking at it? Its atwww.worldenglishbible.tiddlyspot.com and you just go to Matthew in the list of books (no permalink in Firefox) It doesn't do anything now when you click on the buttons :-( I'm certain I put exactly what you said. And sorry, it takes a while to load (6.7 M - I'm afraid by the time I finish this it'll need a really fast computer to run it) Thanks Eric -Dave On Mar 8, 10:34 pm, Eric Shulman elsdes...@gmail.com wrote: Your code does kind of work, but its adding as text, not as math, e.g. if I start with versecount of 0, then press the button, the versecount (and thus the window.fetStartIndex) becomes 015, then 01515. oops! to convert the retrieved text into a number, use the parseInt (...) function, like this: var c=parseInt(store.getValue(tiddler,vc))- window.fetItemsPerPage; -e- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~--~~~~--~~--~--~---