Hi guys,
The Qualify Macro & the javascript version, the Widget class'
"this.getStateQualifier()" method are key to differentiating WHERE is the
total widget tree the current widget/tiddler is located. It allows me to
build a state tiddler for the CSV Widget render-er as below during the
"this.execute()" method:
```
var title = this.getAttribute("tiddler", this.getVariable("currentTiddler"
)),
stateTitle = "$:/widgets/csv/" + title + this.getStateQualifier();
this.stateTiddler = $tw.wiki.getTiddler(stateTitle);
if(!this.stateTiddler){ //Build stateTiddler Fields and save it
```
When the widget code is called - when a tiddler with type: application/csv
is displayed in the story river - it generated a different state-value than
if that tiddler was transcluded through another tidder. This means the UI
settings, such as how many rows-per page, and which page you are on, can be
different values - and it is all handled appropriately behind the scenes.
Because I transclude other tiddlers with wiki-code when I build the CSV
table html, I manually set a `<<stateTiddler>>` value in javascript that
can then be accessed by anything rendered WITHIN the widget.
I have demos of this behavior in my latest JsonMangler demo wiki:
https://joshuafontany.github.io/TW5-JsonMangler/
Open the "Csv/vgsales" tiddler is open on launch. In the Recents sidebar
tab there is a tiddler named "CSV Transclude Test". Open that. Manipulate
each UI indepenetendly (open the CSV file icon at the top of the table for
full options).
Best,
Joshua Fontany
On Thursday, February 6, 2020 at 8:56:20 AM UTC-8, Mohammad wrote:
>
> Hi Mat,
> I closely follow your PR on the GitHub!
>
> --Mohammad
>
> On Thursday, February 6, 2020 at 8:15:42 PM UTC+3:30, Mat wrote:
>>
>> Side note:
>> As I briefly note in the slugify request
>> <https://github.com/Jermolene/TiddlyWiki5/issues/3379#issuecomment-505042751>,
>>
>> I think we could use slugs, instead of cryptic numbers, for qualify. This
>> should make the "logic" of the mechanism more transparent e.g:
>> *HelloThere-working-with-tiddlywiki* and
>> *HelloThere-customize-tiddlywiki* (i.e this clearly shows which is the
>> surrounding tiddler). And it would be possible to construct qualified
>> tiddlers without the state mechanism by using a slugify operator - for
>> example it would be much simpler to conditionally steer/control a qualified
>> title.
>>
>> <:-)
>>
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/9e251006-6d53-41f2-a1b4-3eb838cb6bc2%40googlegroups.com.