Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-3438

filterMode on Select-Fields has no effect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.3.9
    • 5.3.8
    • None
    • Yes

      When using a info.magnolia.ui.form.field.definition.SelectFieldDefinition a (Vaadin) filterMode can be defined according to https://documentation.magnolia-cms.com/display/DOCS/Select

      This should enable an user to filter the options by a filter-term. This is useful, if you have a lot of options in the select field.

      However, this option has no effect because of two reasons:

      info.magnolia.ui.form.field.factory.SelectFieldFactory disables text input with setTextInputAllowed(false); on the combobox, which sets "readonly" on the input-field. See https://jira.magnolia-cms.com/browse/MGNLUI-1088

      Second reason is that in the same class pageLength is set to 0 (setPageLength(0)). This was done in 5.3.8 (https://jira.magnolia-cms.com/browse/MGNLUI-3297) and disables the previous paging on select fields (which was set to 10).

      Problem is, that the vaadin-combobox ignores filters, when pageLength is 0, see

      com.vaadin.ui.ComboBox.getOptionsWithFilter(boolean)

      The isssue can be solved by re-enabling textinput and set the page-length to a (high) value:

      @Override
        protected AbstractSelect createFieldComponent() {
            select = super.createFieldComponent();
            if (select instanceof ComboBox) {
              ((ComboBox) select).setFilteringMode(FilteringMode.CONTAINS);
              ((ComboBox) select).setTextInputAllowed(true);
              ((ComboBox) select).setPageLength(100);
              
            }
      
            return select;
        }
      

        Acceptance criteria

              ajuran AntonĂ­n Juran
              ademasi Adi De Masi
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD