Skip to content
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

Not possible to add custom system labels for the Select2Choice #121

Open
JouriFledderman opened this issue Jan 26, 2021 · 0 comments
Open

Comments

@JouriFledderman
Copy link

In Select2ChoiceBaseComponent there is the getEscapedJsString function:

 protected String getEscapedJsString(String key) {
   String value = getString(key);

   return Strings.replaceAll(value, "'", "\\'").toString();
 }

which is called multiple times in the onInitialize function, for example:

getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");

In this way it is not possible to add your own labels, since it is always overwritten by the system defaults. For example getSettings().setFormatNoMatches("foo") will not result in a label "foo" when there are matches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant