Replies: 1 comment 3 replies
-
|
Hi, I think it's a very good question, there has been some similar feedback and discussion around these things before. And I can see that it's a relatively common scenario. There are different opinions on which situations should actually be warned about and not. One approach is just to simply filter and ignore the warnings. It is actually somewhat justifiable, as the warnings shouldn't really cause major issues, like crashes. Although it's not entirely defined how it ends up behaving. I do find your suggestion with an "execution" check quite interesting. However, I wonder if turning off synchronization like that goes a bit against the data binding philosophy, the evaluated RML would end up depending on its history. And requiring manual intervention makes it a bit of an advanced feature, where other users might decide to live with the warnings for seemingly the same behavior. One approach that's been discussed earlier is the idea of a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
i'm just playing with RmlUi because it's fun. Let's say we have a Location, and there is std::vector of teams which may be on that location. Since the list could be large, instead of making data-for (which would have to be nested inside data-for for map's Location elements), i wanted to show only the first element of the vector, if the vector's size is larger than zero.
Something like this:
<img data-if="place.teams.size > 0 && !place.teams[0].is_moving" data-attr-src="place.teams[0].portrait"/>This, however produces warnings:
Data array index out of bounds.
Could not get value from data variable 'choices.location.places[2].teams[0].portrait
Soo.. any ideas, how to avoid that? Either using some functionality of Rml I am not aware of, or maybe suggesting different way of doing it? The first would be preferable, as i've keep encountering the same situation, where the object may have nullptr child, and if the child is not nullptr, i would want to render it.
The error is not about places[2], because its inside data-for place : places
BTW it would be very nice having something like
<div data-assert="!null( variable" data-other-expressions>where "data-other-expressions" within that particular element would not be checked/executed and element would not be rendered if data-assert would fail. Or any other way which would allow to tell "this variable may be null"
Beta Was this translation helpful? Give feedback.
All reactions