Announcement

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

    How to Escape HTML in MultiComboBoxItem

    Hi Isomorphic,

    Can you please give me an example of how to escape HTML in the dropdown for a MultiComboBoxItem.

    I cannot seem to find the combination of settings.

    Click image for larger version  Name:	escape.png Views:	0 Size:	10.5 KB ID:	269756

    Code:
            setOptionDataSource(userDs);
            setOptionOperationId(UserConstants.OPERATION_FETCH_REFERENCES_PLUS);
            setForeignDisplayField(UserConstants.USER_NAME);
            setValueField(UserConstants.USER_NAME);
            setMultiple(Boolean.TRUE);
            setWidth(FULL);
            setEscapeHTML(Boolean.TRUE);
            setAutoFetchData(Boolean.FALSE);
            ComboBoxItem properties = new ComboBoxItem();
            properties.setWidth(200);
            properties.setHint("Enter User Id (Username)");
            properties.setSortField(UserConstants.USER_NAME);
            ListGrid pickListProperties = new ListGrid();
            pickListProperties.setDataFetchMode(FetchMode.PAGED);
            pickListProperties.setDataPageSize(SharedConstants.DEFAULT_DATA_PAGE_SIZE);
            pickListProperties.addFetchDataHandler(event -> {
                if (event == null) return;
                DSRequest request = event.getRequestProperties();
                if (request != null) request.setTextMatchStyle(TextMatchStyle.STARTS_WITH);
            });
            properties.setEscapeHTML(Boolean.TRUE);
            properties.setPickListProperties(pickListProperties);
            setComboBoxProperties(properties);
    Thanks

    #2
    I also need it to escape after selection.


    Click image for larger version

Name:	escape1.png
Views:	92
Size:	4.4 KB
ID:	269758

    Comment


      #3
      I have solved the drop-down escaping, using the following.

      Code:
      ListGridField field = new ListGridField(UserConstants.USER_NAME);
      field.setEscapeHTML(Boolean.TRUE);
      properties.setPickListFields(field);

      Now I just need a solution for the selected value.

      Comment


        #4
        OK, figured that out as well.

        Code:
        IButton button = new IButton();
        button.setTitleFormatter((component, title) -> StringUtil.asHTML(title));
        setButtonProperties(button);

        Comment

        Working...
        X