This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-fd740d8f-947a-40ae-945b-9f421db52d98 XWIKI-25647 Open

The list filter doesn't display a filter value set by the live data configuration when its options come only from a search URL

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-6077ab7d-1d19-40eb-9c49-d509d9123aad Simon Urli created this issue on 04/Nov/26 11:39
 
Summary: The list filter doesn't display a filter value set by the live data configuration when its options come only from a search URL
Issue Type: cid:jira-generated-image-avatar-fd740d8f-947a-40ae-945b-9f421db52d98 Bug
Affects Versions: 18.4.6
Assignee: Unassigned
Components: Live Data
Created: 04/Nov/26 11:39
Priority: cid:jira-generated-image-static-major-5d2bbce8-3816-4f7c-98a3-19a0a0949995 Major
Reporter: Simon Urli
Description:

Steps to reproduce

  1. Have a class with a static list property, e.g. status with the values DRAFT=draft|DISCLOSED=disclosed, and a few pages holding an object of it with different values.
  2. Display them in a live data which filters on that property by default, either with the macro parameter or with the live data configuration:
    {{liveData
      id="test"
      properties="doc.title,status"
      source="liveTable"
      sourceParameters="className=Sandbox.TestClass"
      filters="status=DISCLOSED"
    /}}
    

    or

    {"query": {"filters": [{"property": "status", "constraints": [{"operator": "equals", "value": "DISCLOSED"}]}]}}
    
  3. View the page.

Expected

The status column filter (and the advanced filter panel) display the default filter value, disclosed, so that the user knows the entries are filtered and can remove the filter from there.

Actual

The entries are correctly filtered, but the status column filter and the value of the advanced filter panel look empty: the user can't see that the entries are filtered, nor remove the filter from the column.

Cause

In FilterList.vue, the selectize settings pass options: this.config.options || []. When the filter descriptor has no options (the values are only suggested through its searchURL, as for a static list property of the liveTable source), that empty array replaces the option Tom Select creates from the initial value of the input. The initial item is then dropped since no option matches it, so it's not selected, and its label is never loaded through loadSelected.

Reproduced on 18.4.6 (Tom Select). The same FilterList.vue code is in 17.10.0 (Selectize), not verified there yet.

Workaround

Pass the options of the list filter explicitly in the live data configuration, so that the initial value is among them:

{"meta": {"propertyDescriptors": [{"id": "status", "filter": {"options": [{"value": "DRAFT", "label": "draft"}, {"value": "DISCLOSED", "label": "disclosed"}]}}]}}
 
 

1 update

 
cid:jira-generated-image-avatar-6077ab7d-1d19-40eb-9c49-d509d9123aad Changes by Simon Urli on 04/Nov/26 11:44
 
Description: h2. Steps to reproduce

# Have a class with a static list property, e.g. {{status}} with the values {{DRAFT=draft|DISCLOSED=disclosed}}, and a few pages holding an object of it with different values.
# Display them in a live data which filters on that property by default, either with the macro parameter or with the live data configuration:
{code}
{{liveData
  id="test"
  properties="doc.title,status"
  source="liveTable"
  sourceParameters="className=Sandbox.TestClass"
  filters="status=DISCLOSED"
/}}
{code}
or
{code}
{"query": {"filters": [{"property": "status", "constraints": [{"operator": "equals", "value": "DISCLOSED"}]}]}}
{code}
# View the page.

h2. Expected

The {{status}} column filter (and the advanced filter panel) display the default filter value, {{disclosed}}, so that the user knows the entries are filtered and can remove the filter from there.

h2. Actual

The entries are correctly filtered, but the {{status}} column filter and the value of the advanced filter panel look empty: the user can't see that the entries are filtered, nor remove the filter from the column.

h2. Cause

In {{FilterList.vue}}, the selectize settings pass {{options: this.config.options || []}}. When the filter descriptor has no options (the values are only suggested through its {{searchURL}}, as for a static list property of the {{liveTable}} source), that empty array replaces the option Tom Select creates from the initial value of the input. The initial item is then dropped since no option matches it, so it's not selected, and its label is never loaded through {{loadSelected}}.

Reproduced on 18.4.6 (Tom Select).
The Not reproduced on 17.10.0 (Selectize), which has the same {{FilterList.vue}} code is in 17.10.0 : the bug was probably introduced by the switch to Tom Select ( Selectize XWIKI-24088 ) , not verified there yet .

h2. Workaround

Pass the options of the list filter explicitly in the live data configuration, so that the initial value is among them:
{code}
{"meta": {"propertyDescriptors": [{"id": "status", "filter": {"options": [{"value": "DRAFT", "label": "draft"}, {"value": "DISCLOSED", "label": "disclosed"}]}}]}}
{code}