-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for dynamic class in third party ui nodes #1240
Comments
I could really do with some help here, I cannot work out how to handle If I send in
If now I send in So for the moment I am stuck, unable to implement dynamic classes in the node, so help would really be appreciated. |
I have managed to work around the problem by the horrible hacky technique below. The problem is that msg.class or msg.ui_update.class add to the class of the outer widget element, which is not directly accessible to the widget. In order to achieve this immediately when a message is received I have had to add a
then in the message handler:
and
This is obviously not ideal. If there is not currently a better way then I think something needs to be provided to the framework. |
@joepavitt is there must be a better way for me to handle this? |
I'm om holiday this week @colinl - I'll address it next week once I'm back |
Great, thanks. |
Perhaps the best way to move this forward would be to add class handling to the example ui node. With a field for the configuration of class, and the ability to change it dynamically. Then it will be clear what the recommended technique is. If the example could also include the use of |
Thanks Bart. |
@colinl:
So the div gets the nrdb-video class, and on top of that it gets the class name(s) specified in the config screen. These class names are all appended. If you are not sure, you can right click on your element in the browser and choose "Inspect" from the popup menu. Then you can see all the classes that are applied to your div. You can see it in action on my wiki. |
Do you know what it is that adds it immediately when it is updated dynamically? Is it the mapState stuff? |
I am not seeing quite what you describe. I specified a class
Note that class When I then inject the green border I get
It has added the border colour, but again not where I would have expected it. I don't understand what |
Sorry it's taken so long to look at this.
This should be the case. We have the |
Thanks Joe, I didn't realise it should work out of the box. Now I need to find what it is that is missing from my node. |
I'm not working today, but UI Example should have the answer |
Yes, I am working through looking for what I am missing. |
Sorry for the late response @colinl, due to lack of time. |
I haven't done any more yet, also due to lack of time. Did you notice my comment noting that even though you have Also could you explain what |
Description
I don't know whether this is a feature request or just a request for guidance.
Server side the dashboard includes seamless support for class control. The developer merely needs to provide a config field
className
for the node. This results in aclassName
field in theprops
sent to the node on page refresh. In addition there is aclass
field inprops
that is initially an empty string.If a message containing
msg.class
ormsg.ui_update.class
then the dashboard automatically includes that setting inprops.class
.Client side there appears to be partial support. On opening the page, both the configured className and any class passed in via a message, automatically appear in the top level widget element in the DOM, which is perfect. However, when
msg.class
ormsg.ui_update.class
are sent to the node, the DOM does not immediately update, it does not update until the page is refreshed.So the question is, does the developer need to provide support for this, or should the dashboard core code do this automatically? If the developer needs to do something then what is it?
I tried setting
props.class
when a message is received but that did not cause the DOM to change.See this forum post for background info.
Have you provided an initial effort estimate for this issue?
I am no FlowFuse team member
The text was updated successfully, but these errors were encountered: