Dynamic display settings (like edit settings)


Feature request :

Hello,

This feature allow us to use a Dataset URL instead of the default UI alter values. The format return by API should be [{value: 'my-value, label: 'my-label'}, ....] like your own system. So we could setup the display setting with this type of UI:
Capture d’écran 2022-04-21 à 01.48.23

Usefull if you have a long list of altered value (in my case I use a languages and countries lists).


How to do for now :

my model (sequelize):

....
      countryOfResidence: {
        type: DataTypes.ENUM(Object.keys(COUNTRY_CODE)),
      },
....

I use smart field with this config :

{
      field: 'smartCountryOfResidence',
      type: 'Enum',
      enums: Object.values(COUNTRY_CODE),
      get: (data) => COUNTRY_CODE[data.countryOfResidence],
      set: (data, value) => {
         const countryCode = lodash.findKey(COUNTRY_CODE, (countryName) => countryName === value);
         data.countryOfResidence = countryCode;
         return data;
      }
}

with COUNTRY_CODE:

{
  FR: 'FRANCE',
  DE: 'GERMANY'
   ....
}

Hi again Justin,

Very clear, thanks for the suggestion. Not sure why we didn’t think of it in the first place (maybe “Alter values” didn’t exist at the time, can’t remember :slight_smile: ). Anyway, this could indeed be really useful: I’ve added it to our backlog.

Cheers,
Marc