-
I'm working on a widget. I want the widget to process the evaluated contents of itself and replace that with computed DOM nodes. I found some code elsewhere that suggested "makeChildWidgets(),renderChildren(),parent.innerHTML":
This is giving me what I want except for an error in removeLocalDomNodes() where the parent is apparently null. What am I doing wrong? What should I be doing? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
Do you use the latest TW master branch for your development? You should avoid to write to |
Beta Was this translation helpful? Give feedback.
-
You can have a closer look, how other widgets do it eg: the radio-button |
Beta Was this translation helpful? Give feedback.
-
Hi @andrewgoz it causes problems for widgets to modify the DOM nodes produced by their children. Subsequent refresh cycles might need access to the DOM nodes, and raise an error because they no longer exist. An alternate pattern is used by the core Dynannotate widget to replace or augment the DOM nodes produced by child widgets: the child DOM nodes are rendered to a DIV that can be hidden and shown as required. |
Beta Was this translation helpful? Give feedback.
-
So, the problem was where I was calling
I replaced it with:
and the error has gone away. My plans for Unless there is a problem with this I'm not seeing? |
Beta Was this translation helpful? Give feedback.
-
Last year I did a plugin for Google Charts, which is always online. I've been looking at various offline chart libraries and trying to work out which one will do what I want and is within my capabilities of developing a suitable TiddlyWiki plugin. So far the front runner is ApexCharts (https://www.apexcharts.com/). That library needs an "options" data structure. I've been working on how to build that inside the contents of the widget, so it looks like:
Importantly, I want to be able to run <$list> macros in there so that chart data can be built from tiddlers. I have just uploaded my work in progress to: http://www.scss.com.au/family/andrew/tiddlywiki/ There's a demo chart in the plugin readme, that doesn't do anything fancy like running a <$list>, although I've got the <$list> working on a private wiki. I'll see what I can do when I get home from work tonight. Also, I've found that doing I often think that my TiddlyWiki development process involves throwing random things into the code and seeing what works... |
Beta Was this translation helpful? Give feedback.
-
http://www.scss.com.au/family/andrew/tiddlywiki/ has now been updated with my latest plugin and some demo charts where the date is obtained from selected tiddlers. This is apparently working just fine, only throwing errors when the chart configuration structure is incorrect in some way. There doesn't appear to be a lot I can do about that. Thanks everyone for your contributions. I appreciate your time and efforts. |
Beta Was this translation helpful? Give feedback.
-
Hi @andrewgoz you might be interested in the |
Beta Was this translation helpful? Give feedback.
So, the problem was where I was calling
I replaced it with:
and the error has gone away. My plans for
world dominationwidget development can proceed...Unless there is a problem with this I'm not seeing?