Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FeatureEditor - relational dropdown according to another field #643

Open
2 of 8 tasks
Gaetanbrl opened this issue Aug 8, 2023 · 0 comments
Open
2 of 8 tasks

FeatureEditor - relational dropdown according to another field #643

Gaetanbrl opened this issue Aug 8, 2023 · 0 comments

Comments

@Gaetanbrl
Copy link
Contributor

Description

As data editor, i need to select a value from a list calculated by by an other field value, to select a correct relational value (dependent on another).

This contribution could enhance featureEditor rules.

I see 2 solutions.

First, from dropDown, allow to request an API to get a list of values according :

{
  "name": "FeatureEditor",
  "cfg": {
    "maxZoom": 21,
    "customEditorsOptions": {
      "rules": [{
        "regex": {
          "attribute": "NAME_OF_THE_ATTRIBUTE",
          "url": "regex to match a specific url",
          "typeName": "layerName"
        },
        "editor": "DropDownEditor",
        "editorProps": {
          "values": ["Opt1", "Opt2"], => default
          "api": {
            "url": "http://test.fr/", => allow to just keep values returns by entire url API
            "field": "region" => optional => Allow to use another field value as requestParam
          }
        }
      }]
    }
  }
}

Second, use a complex dropDown config to specify many options according to another value.

This second option could use a config like :

{
  "name": "FeatureEditor",
  "cfg": {
    "maxZoom": 21,
    "customEditorsOptions": {
      "rules": [{
        "regex": {
          "attribute": "NAME_OF_THE_ATTRIBUTE",
          "url": "regex to match a specific url",
          "typeName": "layerName"
        },
        "editor": "DropDownEditor",
        "editorProps": {
          "values": ["Opt1", "Opt2"], => default
          "relation": [ => new relational
            {"field": "region", "selected": "britania", "values": ["Opt1", "Opt2"]}
            {"field": "region", "selected": "est", "values": ["Opt1", "Opt2"]}
          ]
        }
      }]
    }
  }
}

I guess that many solutions are possible...

What kind of improvement you want to add? (check one with "x", remove the others)

  • Minor changes to existing features
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Mapstore2georchestra improvement
  • Mapstore2 improvement
  • Other... Please describe:

Other useful information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant