Thanks Mario, this is very helpful.

On Saturday, March 7, 2015 at 3:10:06 PM UTC-5, PMario wrote:
>
> On Saturday, March 7, 2015 at 7:37:11 PM UTC+1, PE Pat wrote:
>>
>> And once that push has been executed, how do you use the array in the 
>> addTiddler command to rewrite a list field?
>>
>>
> If you open your browser console (F12) at tiddlywiki.com and type: 
>
> $tw.wiki.getTiddler("HelloThere")
>
> You'll get a tiddler object, that contains all the fields. ,,, If you 
> expand them in the explorer, you'll see, that they are protected. 
> By design the tiddler store contains immutable tiddler objects. 
>
> As you found out you'll need to use the $tw.wiki.addTiddler() function to 
> modify existing tiddlers. 
>
> So the typical workflow is like this. 
>
>  - read an existing tiddler
>  - set your fields
>  - addTiddler( new Tiddler())
>
>
> var tiddler = $tw.wiki.getTiddler("HelloThere"),
>     fields = {"myfield":"asdf aaaa bbb"}
>
> $tw.wiki.addTiddler( new 
> $tw.Tiddler(tiddler,fields,$tw.wiki.getModificationFields())); 
>
>
> Important: see the new $tw.Tiddler() in the line above.  That's the only 
> way to modify a tiddler. 
>
> But be aware, that the only fields that the core treats as arrays are list 
> and tags
>
> So imo you'll need to explore the source code for usage examples, 
> depending on your usecase. 
>
>
> Creating a new tiddler
>
> var fields = {"title": "my new tiddler", "text":"some text", 
> "myfield":"asdf bbbb"}
>
> $tw.wiki.addTiddler( new 
> $tw.Tiddler(fields,$tw.wiki.getModificationFields())); 
>
> Important: If you miss the $tw.wiki.getModificationFields() you can't see 
> the new tiddler in the recent tab. 
> There are several more "init" functions in the wiki.js source code. ... 
>
> Hope that helps. 
>
> have fun!
> mario
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to