Thanks a lot. This is exactly what I was looking for. Also one more
question if you don't mind. Is there any way to have a table instead of
mundane way of having a " - " in between the word and the meaning?
Regards
Shash
On Thursday, May 28, 2015 at 7:46:48 PM UTC+5:30, Jed Carty wrote:
>
> This one is very simple and uses a single data tiddler to save the entries
> in key-value pairs so adding a new field to an entry isn't a trivial task.
> There are a few ways to do it but the most straight forward way would be to
> create another data tiddler for each field you add. If you want to keep it
> all in two tiddlers you can, but that gets a bit more complex.
>
> Here is the simplest way I to add a new field I can come up with at the
> moment. I am working on my tablet so I didn't do much testing. Go through
> and change everywhere it says 'newfield' to whatever you want to call the
> new field and it should work. If you want to add more fields than you can
> just do the same edits I did again for each new field.
>
> \define thisListMacro()
> <$view field=title/> - {{$:/data/Dictionary##$(thisIndex)$}} -
> {{$:/data/Dictionary/newfield##$(thisIndex)$}}<br>
> \end
>
> \define thisEditListMacro()
> <$view field=title/> - {{$:/data/Dictionary##$(thisIndex)$}} -
> {{$:/data/Dictionary/newfield##$(thisIndex)$}}
> <$button>Remove<$action-deletefield $tiddler='$:/data/Dictionary'
> $field=$(thisIndex)$ $value=''/></$button><br>
> \end
>
> \define thisRegEx()
> $(thisSearch)$(?i)
> \end
>
> \define thisSearchMacro()
> <ul>
> <$list
> filter="[[$:/data/Dictionary]indexes[]regexp:title[(?i)$(thisSearch)$]]">
> <li><<currentTiddler>> - <$transclude tiddler="$:/data/Dictionary"
> index=<<currentTiddler>>/> - <$transclude
> tiddler="$:/data/Dictionary/newfield" index=<<currentTiddler>>/></li>
> </$list>
> </ul>
> \end
>
> \define thisEditMacro()
> <ul>
> <$list
> filter="[[$:/data/Dictionary]indexes[]regexp:title[(?i)$(thisSearch)$]]">
> <$set name=thisItem value=<<currentTiddler>>>
> <li><<thisDeleteButton>> <<currentTiddler>> - <$transclude
> tiddler="$:/data/Dictionary" index=<<currentTiddler>>/> - <$transclude
> tiddler="$:/data/Dictionary/newfield" index=<<currentTiddler>>/></li>
>
> </$set>
> </$list>
> </ul>
> \end
>
> \define thisDeleteButton()
> <$button
> set='$:/data/Dictionary##$(thisItem)$'>{{$:/core/images/delete-button}}</$button>
>
>
> \end
>
> Term: <$edit-text class='tc-edit-texteditor' tiddler='$:/temp/dictionary'
> field='name'/><br>
> Meaning: <$edit-text class='tc-edit-texteditor'
> tiddler='$:/temp/dictionary' field='meaning'/><br>
> Newfield: <$edit-text class='tc-edit-texteditor'
> tiddler='$:/temp/dictionary' field='newfield'/><br>
> <$reveal type='match' state='$:/temp/dictionary!!name' text=''>
> <$button>Add Term</$button>
> </$reveal>
> <$reveal type='nomatch' state='$:/temp/dictionary!!name' text=''>
> <$button>Add Term
> <$action-setfield $tiddler='$:/data/Dictionary'
> $index={{$:/temp/dictionary!!name}}
> $value={{$:/temp/dictionary!!meaning}}/>
> <$action-setfield $tiddler='$:/data/Dictionary/newfield'
> $index={{$:/temp/dictionary!!name}}
> $value={{$:/temp/dictionary!!newfield}}/>
> <$action-setfield $tiddler='$:/temp/dictionary' name='' meaning=''
> newfield=''/>
> </$button>
> </$reveal>
> <$reveal type='nomatch' state='$:/state/dictionary/editreveal'
> text='edit'>
> <$button set='$:/state/dictionary/editreveal' setTo='edit'>Edit
> Dictionary</$button>
> </$reveal>
> <$reveal type='match' state='$:/state/dictionary/editreveal' text='edit'>
> <$button set='$:/state/dictionary/editreveal' setTo='noedit'>Done
> Editing</$button>
> </$reveal>
>
> Search: <$edit-text tiddler='$:/temp/dictionary' field='search'/><br>
> <$reveal type='nomatch' state='$:/state/dictionary/editreveal'
> text='edit'>
> Type in the search box to find specific items on the list
> </$reveal>
> <$reveal type='match' state='$:/state/dictionary/editreveal' text='edit'>
> Click on the trashcan icon to remove an item
> </$reveal>
> <$set name='thisSearch' value={{$:/temp/dictionary!!search}}>
> <$reveal type='nomatch' state='$:/state/dictionary/editreveal'
> text='edit'>
> <<thisSearchMacro>>
> </$reveal>
> <$reveal type='match' state='$:/state/dictionary/editreveal' text='edit'>
> <<thisEditMacro>>
> </$reveal>
> </$set>
>
> Let me know how it works for you. I am a bit surprised anyone is using my
> stuff.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/75ed8307-7f98-4565-85c9-5d9a94907b37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.