Skip to content

Use another layer as input for attribute table dropdown #11143

@mahmoudadel54

Description

@mahmoudadel54

Description

in Mapstore is an option to use a WPS to show unique values in the attribute table while creating new features: Attribute Table - MapStore
We would like to be able to configure a layer in Mapstore to use another layers pagedUnique values for a certain column.
So for example layer A has column 1 and we receive unique values from layer B column 12 while creating or editing features in layer A.

Acceptance criteria

MS currently supports editor configuration and custom editor props, allowing downstream projects to implement their own editors with the necessary supporting logic.

In most cases, this can be achieved by creating a custom editor for the string data type—either using the AutocompleteCombobox or, for more control, a paged combobox/autocomplete field enhanced with stream handlers and autocomplete stream factory. This allows customization of data fetching logic. The editor should be registered once the map configuration is loaded. However, this approach requires multiple coordinated code changes to work seamlessly with the FeatureEditor, making it a relatively involved implementation.

With this issue, we can introduce the following enhancements

  • Enhance the documentation with clear usage instructions and examples for better understanding
  • Create a default autocomplete combo box editor that supports fetching data based on editor props configuration. This enables retrieval of attribute values for a specific layer and column. Users only need to provide a configuration object in the following format on FeatureEditor plugin
    {
      "customEditorsOptions": {
        "rules": [
          {
            "regex": {
              "attribute": "ATTRIBUTE_NAME", // target attribute name or column
              "typeName": "DEST_TYPE_NAME" // target layer or typename
            },
            "editor": "CustomAutocompleteEditor", // example default editor
            "editorProps": {
              "isValidRegex": "" // optional, regex to validate the value
              "filterProps": {
                "blacklist": [], // optional
                "maxFeatures": 3, // optional, default 3
                "queriableAttributes": ["ATTR_1"],
                "predicate": "ILIKE", // optional, default `ILIKE`
                "srsName": "EPSG:4326", // optional,  default `EPSG:4326`
                "typeName": "SOURCE_TYPE_NAME" // source layer or typename
              }
            }
          }
        ]
      }
    }

Other useful information

Metadata

Metadata

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions