Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Linefeeds in Hovers like in ListGrid rows in 5.1p

    Hi Isomorphic,

    please see this ListGrid screenshot (latest 5.1p): Click image for larger version

Name:	Screenshot.png
Views:	34
Size:	92.3 KB
ID:	240106


    It seems that you replace line feeds in the data with <br>, which is what is needed here.
    You don't do the same in hovers, for either just myListGridField.setShowHover(true) or also myListGridField.setHoverCustomizer().

    Is this on purpose?

    Also, I have a small issue with myListGridField.setHoverCustomizer():
    I want to show a popup with some extra information if the field is not empty:
    Code:
            setHoverCustomizer(new HoverCustomizer() {
                @Override
                public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
                    if (value == null [B]|| "&nbsp;".equals(value)[/B])
                        return null;
                    String retVal = "<b>" + value.toString() + "</b><br/><br/>";
                    String description = record.getAttribute("DESCRIPTION");
                    if (description == null)
                        return retVal + i18n.noDescriptionGiven();
                    else
                        return retVal + description;
                }
            });
    Just comparing to null (which is the value in the DB) does not work. Is the &nbsp; on purpose, and if so, can I rely on it?

    Thank you & Best regards
    Blama
    Last edited by Blama; 7 Sep 2016, 05:59. Reason: Screenshot and source is of a ListGrid row

    #2
    We change LF to <br> or not depending on your setting for field.escapeHTML. We can't do likewise with hovers since it would prevent any markup you return from hoverHTML from working.

    It's not clear what you're asking in the second question. "&nbsp;" is probably your setting for emptyCellValue, if so, yes, you can rely it on appearing as the value.

    Comment


      #3
      Hi Isomorphic,

      thanks for the explanation on #1. I'll do the linefeed conversion then myself.
      Code:
          public static String formatLineBreak(String value) {
              if (value == null)
                  return null;
              else
                  return value.replace("\r\n", "<br />").replace("\n", "<br />").replace("\r", "<br />");
          }
      #2 is about what you wrote. I did not know that this is a configurable value with a getter I can compare to.

      Best regards
      Blama

      Comment

      Working...
      X