Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25647

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 18.4.6
    • Live Data
    • Unknown

    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). Not reproduced on 17.10.0 (Selectize), which has the same FilterList.vue code: the bug was probably introduced by the switch to Tom Select (XWIKI-24088).

      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"}]}}]}}
      

      Attachments

        Issue Links

          Activity

            People

              pjeanjean Pierre Jeanjean
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: