Closest ancestor as target element. - #1
Conversation
|
Hi, Technically, it looks ok. My doubt is about functional aspect. The primary aim of the widget is to manipulate css classes per global selectors by custom logic. Your case is different: your logic is implemented elsewhere (in your test project it's in the two additional containers per Chart Data list view item with conditional visibility: $currentObject/Series = N) and the only reason of using our widget is to set css class for LI ancestor (which is impossible by normal css selectors and requires JavaScript). It looks there are better widgets for this aim, e.g. Attribute Helper: https://appstore.home.mendix.com/link/app/111554/). So my impression is that I'd rather leave the widget as it is and use another solution for your need. How do you think? |
|
Thanks 😊 I completely agree with you about the issue of wood full of similar widgets. As for the attr helper one, I’ve seen the limitation (no class/style attrib), but have you tried using it with a dedicated custom attribute like “data-listview-item-type”? You could then handle it in your CSS with by attribute selector [], e.g.: li[data-listview-item-type=warning]{...} And right, our widget has no entity context (doesn't need it in the original design); and using a nanoflow for each row just to return a static string seems wrong, at least from performance point of view. |

Hi,
For a pet project of mine I wanted to add classes to specific listitems in a listview.
So I added the option to look for the closest ancestor related to current element in the dom tree.
This enables you to set classes per item in a listview.
I'm curious what you think about the feature.