-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Dropdown "action" as a custom function with "set text" not updating correctly #2955
Comments
Thanks for reporting. For the record: We'll investigate further how to fix/support using "set text" as a custom function (quick idea: enhance the set text function to support some kind of "force" parameter which will ignore the action setting or always set it when action is a custom function....... but we need to test this a bit more |
For anyone else having the same issue, I used javascript/jquery to find the For example: const textElement = dropdown.siblings(".text");
textElement.text(newText); It would be good for this to be fixed to avoid others using this behavior by mistake, alternatively update the documentation to explain when you shouldn't use it. Thanks for investigating the issue, and good luck :) |
Fixed by #2958 |
@lubber-de wow, that was impressively fast! Nice job. Thank you very much! EDIT: I'll let you close this when you're ready/it's merged. |
Has this been released yet? I wouldn't mind updating the library soon. Thanks! |
It's available via npm nightly beta or jsdelivr beta cdn Just use |
Bug Report
I have just switched from SemanticUI to FomanticUI using the same code as shown in the snippet and the
set text
behavior no longer updates the text of the dropdown. I have heard thatset text
might be used behind the scenes for the FomanticUI dropdown component but all solutions tell me to useonCallback
instead, but I can't get this approach to work. I would rather theaction
be fixed so I can continue to use it, if possible.Steps to reproduce
allowAdditions
set to true andaction
set to a custom function that triggersset text
andset value
behaviors to manually set the text and value of the dropdown .Expected result
The text of the Dropdown component should be set and rendered to the value passed to the call that triggered
set text
.Actual result
The dropdown's text element remains empty.
Testcase
This shows the issue using FomanticUI: https://jsfiddle.net/mikelogit/874caudh/7/
This is the same code but using SemanticUI (and works): https://jsfiddle.net/mikelogit/eu8s6fyL/1/
The custom
action
callback is used to intercept a value provided by the user in the search box. It checks to see if the entered value is the same as the text, and if so, it updates the value by dividing it by the integer value assigned to thedata-precision
attribute. Also, the text is formatted to include commas for large numbers.For example, if the user enters "5500" it should set the text to "5,500" and set the value to "5.5" (when data-precision="1000"). If an already existing dropdown value is selected, only the text is formatted and updated, and the new value is set without any changes.
Screenshot (if possible)
This is with SemanticUI when it worked correctly:
But now it's just plank, although the
set value
behavior does seem to work. It's just the text that appears missing:Version
[email protected]
The text was updated successfully, but these errors were encountered: