Closed AndRossi closed 5 years ago
This looks like a problem that is very specific to your setup, and not an Awesomplete bug. We cannot add code to Awesomplete that's specific to Java (or any other specific setup), you may need to inspect what's being passed there and possibly stringify it manually since the way it's automatically stringified doesn't produce the intended result. I'm going to go ahead and close this, but we can reopen if you investigate further and have reason to believe this is an Awesomplete bug!
I'm developing a web application using Java, Spring Boot and Thymeleaf. I am experiencing an issue with an awesomplete input object. I set the data-list attribute of the awesomplete input as a Thymeleaf list of String objects (so I use attribute th:data-list):
This is the result:
As you can see, it kinda works, except for two weird square brackets. The affected items are "Ambasciata italiana a Parigi" and "Ambasciata Statunitense a Roma". Those brackets are not part of the original strings sent by the backend (that's the first thing I have checked).
I believe that those brackets are just the result an error while parsing the the Thymeleaf String List. As a matter of fact, "Ambasciata italiana a Parigi" is the first item in the String List sent by the backend, and "Ambasciata Statunitense a Roma" is the last one.
I'm not really sure of how the Thymeleaf String List is encoded, but it may attach an additional "[" before the first item, and an an additional "]" after the last one. In this case, it just makes sense that the parsing system concatenates them to the first and last items respectively.