question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Any way to dynamically set enum values in smart action?

See original GitHub issue

Hello,

First of all, I’d like to ask if it’s possible to pre-populate form fields in smart action using the model. I couldn’t find an example anywhere so I don’t know if that’s supported. One of the table columns contains a list and I would like to pass it to the ‘enums’ property to make it dynamic. For example:

'use strict';

const Liana = require('forest-express-sequelize');

Liana.collection('country', {
  actions: [{
    name: 'Validate',
    fields: [{
      field: 'comment',
      type: 'String'
    },{
      field: 'continent',
      type: 'Enum',
      enums: ['Africa', 'Americas', 'Asia', 'Europe', 'Oceania'] // this should come from the model
    }]
  }]
});

Thanks.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:6
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
SeyZcommented, Mar 26, 2019

We’re currently working on a set of new Forest Admin’s widgets with the possibility to suggest dynamic values from a dropdown. The next step for us is to set this widget available in smart action forms. Stay tuned

0reactions
callanoccommented, Aug 8, 2022

Any update please ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Smart Action form hooks - Dynamic enums on a referenced ...
I have tested dynamic enums. It works great for “normal” cases. However, are you able to manage the case when the enum values...
Read more >
Generating Enums Dynamically - java - Stack Overflow
Actually it is possible to create enum instances dynamically, but it's a total hack, I wouldn't advise it at all - maybe you're ......
Read more >
Auto-populate Enum Values with existing data
I have worked around this by creating a set of 'Master' records that are filtered out of the slices the user sees, and...
Read more >
Configure Static and Dynamic List of Values Fields
You can add an option to a list of values field (checklist, radio button, or select) by specifying an action Append Option to...
Read more >
AutoMapper.Extensions.EnumMapping
If you want to change some mappings, then you can use MapValue method. This is a chainable method. Default the enum values are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found