Hi BJ
Thanks for getting down to the particulars. My problem is that my widget is
general purpose -- to set the value of any text-reference to the output of
a filter expression. Currently, this will output a comma separated list,
however I imagine that the widget will generally be used to set the value
of a text-reference to a list of tiddler titles.
Lists of tiddler titles are, however, perhaps more useful in space
separated form. For example, an array of lists of tiddler titles, each the
output of a filter expression at some point in time, could be stored in a
data tiddler, then retrieved later (another recent thread points to a
possible use to open and close a list of tiddlers with a particular tag.)
This can be done by the user in two steps by setting the value of a special
'list' field to the output of the filter expression (with my widget), then
setting the value of a text-reference elsewhere to this space separated
list.
However, I wondered whether my widget should not be modified to output a
space separated list in the first instance. Is there any downside to this
behaviour?
regards
regards
On Friday, June 20, 2014 10:42:14 AM UTC+2, BJ wrote:
>
> I do this -
> listofTiddlerTitles = this.getTiddlerList();
> //listofTiddlerTitles is now a javascript array of strings
> (tiddler titles)
> updateFields["list"] = listofTiddlerTitles;
> //tiddlywiki defines in boot.js that the field called 'list' is to
> be converted to a space seperated string containing tiddler titles as
> 'tiddler title words' - eg "mytid [[this tid]]"
> self.wiki.addTiddler(new
> $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,
> self.wiki.getModificationFields()));
>
> if instead I did this:
> listofTiddlerTitles = this.getTiddlerList();
> //listofTiddlerTitles is now a javascript array of strings
> (tiddler titles)
> updateFields["mylist"] = listofTiddlerTitles;
> //tiddlywiki will not know how to convert "mylist" to a string -
> anything could happen?????
> self.wiki.addTiddler(new
> $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,
> self.wiki.getModificationFields()));
>
>
> On Friday, June 20, 2014 9:41:09 AM UTC+2, Matabele wrote:
>>
>> Hi BJ
>>
>> Perhaps an easier way of asking my question:
>>
>> Why is the list field space separated whereas standard fields are not?
>>
>> regards
>>
>> On Friday, June 20, 2014 8:47:04 AM UTC+2, BJ wrote:
>>>
>>> In what sense do you mean 'use'?
>>> in boot you can see:
>>> $tw.modules.define("$:/boot/tiddlerfields/list","tiddlerfield",{
>>> name: "list",
>>> parse: $tw.utils.parseStringArray,
>>> stringify: $tw.utils.stringifyList
>>> });
>>> which means that the 'list' field will be converted from space separated
>>> list of tag-strings (including [[tag forn]] of tags) to an array of strings
>>> (and converted back) whenb reading and writing via javascript. (eg
>>> addTiddler() function)
>>>
>>>
>>> On Friday, June 20, 2014 8:05:36 AM UTC+2, Matabele wrote:
>>>>
>>>> Hi BJ
>>>>
>>>> Thanks -- I was trying to do something like this, but wanted to use a
>>>> field other than the list field -- then I ran across the problem that the
>>>> 'list' field uses a space separated list and other fields use a comma
>>>> separated list. This necessitated creating the list in a 'list' field,
>>>> then
>>>> storing the space separated list into another standard field.
>>>>
>>>> Wondered whether it was possible to use a standard field in exactly the
>>>> same way as the 'list' field?
>>>>
>>>> regards
>>>>
>>>> On Friday, June 20, 2014 7:59:22 AM UTC+2, BJ wrote:
>>>>>
>>>>> Hi Matabele,
>>>>> the list field is used to re-order to a list of tiddlers, you can see
>>>>> how I have used it here:
>>>>> http://bjhacks.tiddlyspot.com/#TagList
>>>>> <http://bjhacks.tiddlyspot.com/#TagList:>
>>>>>
>>>>> cheers
>>>>> BJ
>>>>>
>>>>> On Thursday, June 19, 2014 9:04:28 PM UTC+2, Matabele wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I have been playing around with lists, but am a little confused about
>>>>>> the behaviour of the list (and tags) field when compared with standard
>>>>>> fields.
>>>>>>
>>>>>> Say a standard field 'myfield' contains a comma separated list. If I
>>>>>> then set the value of the 'list' field to this value, the comma
>>>>>> separated
>>>>>> list will be transformed into a space separated list.
>>>>>>
>>>>>> The converse is not true. If I then set the value of 'myfield' to the
>>>>>> value of the 'list' field, the value in 'myfield' will now be space
>>>>>> separated.
>>>>>>
>>>>>> Does this effect the behaviour of filter operators for lists? (can
>>>>>> comma separated and space separated lists be used in the same way?)
>>>>>>
>>>>>> regards
>>>>>>
>>>>>
--
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.
For more options, visit https://groups.google.com/d/optout.