[TW5] Where do I find the table widget file?

65 views
Skip to first unread message

Vincent Yeh

unread,
May 3, 2015, 11:03:58 AM5/3/15
to tiddly...@googlegroups.com
Hi Jeremy,

As you may know I am working on migrating my twve plugins to TW5, and the first one I want to do is the simple calculator twve.tcalc. I went through the document and some of the plugin files, and realized how to create a plugin of my own. Thanks a lot to you and all the plugin authors for the nice and clear comments between the codes. In the mean time, I also realized that the available information is all about creating a custom widget. This is, however, different from what I needed, my calculator does not create tables but work with existing ones.

The current way it works with TW2 is to hijack the refreshing function and does the calculations after the table is refreshed by TiddlyWiki. I am thinking of doing the same way, so started to look for the table widget files, hoping to find a way to hijack it somehow. The closest ones I found were the element.js widget file and the table.js rules file. I did not find a table widget file. Is there such a file in TW5? Or I should just try the trick with the refreshing function in element.js?

Andreas Hahn

unread,
May 4, 2015, 8:43:23 AM5/4/15
to tiddly...@googlegroups.com
Hi Vincent,

there is no such thing as a table widget, tables are treated as normal HTML-elements, thus are handled by the $element widget. In TW5, everything is handled by either parser-rules or widgets, when it comes to translating wikitext to html. Therefore, if you want to hijack every table generated by wikitext, you can do so, by tapping into the parser rules to attach your own widget around a table for instance, so you can do your calculations when they are rendered.

I am however uncertain how difficult it will be to add your functionality, without modifying any of the existing parser-rules, so you might end up having to implement your own "table" widget, in order for users to benefit from the functionality.

/Andreas
--
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 tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/26fbc204-1bd5-41f8-b8a5-f338d18cb99c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vincent Yeh

unread,
May 4, 2015, 8:30:22 PM5/4/15
to tiddly...@googlegroups.com
Andreas,

Thanks a lot for the reply. After reading your suggestions, I went through the element.js and table.js files again and got some ideas to try. I will start testing those ideas and hopefully make a decision soon. Thanks again for the help.

Have fun!
Vincent
Reply all
Reply to author
Forward
0 new messages