Open scauligi opened 11 months ago
Hi, thanks for opening this issue. As also seen in #1721, this seems to be a useful component for extensions :) As a "quick fix", I've re-added the old css and js so you could still use the old ones for a while (however, I haven't re-added the template code so you'd need to copy paste that).
I think there's basically two ways that the new component(s) could be exposed to the frontend: 1) providing them to Javascript extensions (https://svelte.dev/docs/client-side-component-api) or 2) wrapping them in a custom HTML element (just like it is already done for the charts) where the data for the component would be provided as JSON in this custom element. (doing both also be an option)
Could you describe your use case a bit? Are you using them to render a Fava TreeNode
or do you want to render some other tree-like data (like fava_investor seems to do)?
I would like to also be able to access the tree table.
In my use case, I render the balance sheet with only accounts under certain criteria.
(however, I haven't re-added the template code so you'd need to copy paste that)
It's definitely not that simple as just copy and paste, as a lot of code was deleted as part of that change. I had to go through a lot of hoops before it started working again.
To save people some time, this is my _tree_table.html
:
And because many of the filters referenced in the macro has been removed, I have also had to add the following methods into my extension class to be used by the template:
Hope this would be useful.
But it is definitely better if we can just use the same tree table used in the builtin report.
Version 1.26 moved much of the UI generation from templates into svelte/javascript. Before, I could include some of the template helpers (eg for treetables) in my own extension templates, but now that it's in svelte there doesn't seem to be a good way of making my own TreeTables aside from copying-and-pasting code and CSS styles.
Is it possible to expose TreeTables in a way that extensions can more easily use them?