[MGNLUI-3438] filterMode on Select-Fields has no effect Created: 21/May/15  Updated: 19/Apr/16  Resolved: 03/Jun/15

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 5.3.8
Fix Version/s: 5.3.9

Type: Bug Priority: Neutral
Reporter: Adi De Masi Assignee: AntonĂ­n Juran
Resolution: Fixed Votes: 1
Labels: support, ui, usability, ux
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MGNLUI-1088 Combo-boxes should not be editable by... Closed
is related to MGNLUI-3297 Allow for disabling of paging on sele... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Date of First Response:

 Description   

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;
  }


 Comments   
Comment by AntonĂ­n Juran [ 04/Jun/15 ]

After release of ver. 5.3.9 add into docu (link: https://documentation.magnolia-cms.com/display/DOCS/Select, table: "Common properties that apply to all select fields.") properties and their descriptions:
textInputAllowed - If text input is not allowed, the ComboBox behaves like a pretty NativeSelect - the user can not enter any text and clicking the text field opens the drop down with options. Default: false.
pageLength - Holds value of property pageLength. 0 disables paging and filtering. Default: 0.
Add to description of filteringMode property - If pageLength = 0, filtering is ignored.

Generated at Mon Feb 12 09:06:37 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.