avoid to calc same data twice #9251
Unanswered
Rakasch
asked this question in
Help/Questions
Replies: 1 comment 1 reply
-
Just an idea: maybe you could make a new computed (eactive) property |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a table with appointments, the appointments in a td currently look like this:

eventRowsStyle() is a function that calls eventRows() and generates a css style from it.
So eventRows() is currently calculated twice in this td.
Since I call the function frequently in a large table and it contains nested loops, I would prefer to call it only once per td.
In plain js, you would calculate eventRows() once, store the result in a variable, and pass the variable to both functions.
In the view template, this is not possible.
Is there a clean way to solve this?
I came up with a hacky workaround: Introduce a dummy loop, so we have access to the variable.


Better ideas ?
Beta Was this translation helpful? Give feedback.
All reactions