wicket-select2 icon indicating copy to clipboard operation
wicket-select2 copied to clipboard

Not possible to add custom system labels for the Select2Choice

Open JouriFledderman opened this issue 4 years ago • 0 comments

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.

JouriFledderman avatar Jan 26 '21 17:01 JouriFledderman