Changeset 7782


Ignore:
Timestamp:
Feb 28, 2020, 3:28:02 PM (21 months ago)
Author:
Nicklas Nordborg
Message:

References #2202: Include information from parent items in list pages

When a parent item column with a filter is hidden the filter must be removed, since it is not possible to get information about this hidden filter which may confuse the user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r7761 r7782  
    649649        }
    650650       
     651        String allColumns = cc.getSetting("columns");
     652        Set<String> visibleParentCols = new HashSet<>();
     653        if (allColumns != null)
     654        {
     655          for (String col : allColumns.split(","))
     656          {
     657            if (col.startsWith("/")) visibleParentCols.add(col);
     658          }
     659        }
     660
    651661        while (names.hasMoreElements())
    652662        {
     
    667677              property = property.substring(0, split);
    668678            }
     679            if (property.startsWith("/") && value != null)
     680            {
     681              // If the filter is on a parent item and the column is no
     682              // longer visible, we need to remove the filter, since it
     683              // will get very confusing otherwise
     684              // There are some variants when column is the name of a parent item
     685              boolean isOkFilter = visibleParentCols.contains(property)
     686                || visibleParentCols.contains(property.replace("/name", "/."))
     687                || visibleParentCols.contains(property.replace(".name", ""));
     688              if (!isOkFilter) value = null;
     689            }
    669690            if (value != null)
    670691            {
Note: See TracChangeset for help on using the changeset viewer.