Sunday, December 27, 2020

Re: 2.9.0 ListBox getItemText(i) trims result [possible bug]

This html example explains the source of problem. 
I don't know why JS implementaion of ListBox doesn't mask space symbol with  
It's a normal practic for JS implementations for GWT components?

<!DOCTYPE HTML>
<html>
 <head>
  <meta charset="utf-8">
  <title>Тег OPTION</title>
 </head>
 <body> 

  <form action="option1.php">
   <p><select size="5" name="hero">
    <option disabled>     Выберите героя    </option>
    <option value="t1" selected>&nbsp&nbsp&nbsp&nbsp&nbspЧебурашка</option>
    <option value="t2">Крокодил Гена&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</option>
    <option value="t3">Шапокляк</option>
    <option value="t4">Крыса&nbsp&nbsp&nbsp&nbsp&nbspЛариса</option>
   </select></p>
   <p><input type="submit" value="Отправить"></p>
  </form>

 </body>
</html>



понедельник, 28 декабря 2020 г. в 11:11:28 UTC+4, Joker Joker:
I think I found the reason. It's the JS Implementation of  OptionElement#setText.
It discards the last spaces in the string. I see that in debugger. 
Here method input parametr "String text" contains space symbol at the end. 
But after executing  the line "this.text = text;"
this.text contains string without space symbol at the end; 

So do I need to replace all leading and trailing white space characters with "&nbsp;"?

OptionElement.java:
/**
* The text contained within the option element.
*/
public final native void setText(String text) /*-{
this.text = text;
}-*/;

пятница, 25 декабря 2020 г. в 16:11:54 UTC+4, Joker Joker:
I have an issue with GWT 2.9.0 ListBox#getItemText():

String name = listBox.getItemText(i);

The result is a string with extra spaces removed at the end.

Have anybody run into the same problem?

Browser - Chrome/Firefox(latest)


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/9d849866-864f-4917-a6ed-c17d1abea9e1n%40googlegroups.com.

No comments:

Post a Comment