How do I dynamically create Menu Items in the Menu Button column type?

I would like to be able to have a list of key value pairs related to a selected row of a table. Then allow the user to select menu items in the value column with a predefined list of appropriate values. The table that is rendered is dynamic, so the Key/Value set is as well.

Essentially, I am trying to set up a framework where a user can select a table to review, that table is returned, and they can review the appropriate columns via the key value table only applying a configured list of values allowed in that column. I have had limited success with fetching the menu item values with JS, but this requires setting up and adding a lot of menu items and dynamically changing visibility depending on the number of items I want per Key Value pair. Needless to say, this is very hackey. Hoping someone has a better solution to solve this problem. Ideally, there would be a way to pass a data table to the Menu Items config that allows me to say here is the list of menu items and what they each do (or what they all do) for the onItemClick action.

@amitjag Apologies for the late reply. Unfortunately, this may not be possible today as we do not have a JS option on Menu Items.

Thanks Danica,

Yeah, I saw. The new JSON based forms feature might solve this need however, so maybe this hack is just not needed

Hi, @amitjag I want to understand a few more things in depth.

When you are talking about key/value pairs related to a row, what should happen once a user selects a menu item? Does it make a query or does it update the data in that row? We are working on a feature which will enable select widget in table columns, i wanted to understand if that would help.

Do you also know what the maximum number of actions are per row? We want to think about what happens when actions are large.

Hey Dilip,

A Select Widget in table columns would be the ideal solution especially if the list can be configured via JS.

The hack I was attempting to implement was that a user would select a row in a table. Then the data from that row would be converted to key value pairs in another table where the value would be a menu column type. The value would allow the user to select from a list of appropriate values for that field. For example:

Company Name  |  Region  |  Type     |  Currency
ACME                   |  NULL    |   NULL   |  USD
ABC Inc.               |  NULL    |   NULL   |  NULL

User selects row 1, so table 2 would show:

Column    |  Value
Region     |  [Select]
Type         |  [Select]
Currency  |   [USD]

Where [Select] for:
region would show items like APAC; North America; Africa; EMEA; ect. 
Type might be something like Consultant; Asset Manger; Asset Owner ect. 
Currency would show USD,GBP,JPY,EUR, ect. 

Edit: Apologies for the terrible formatting

I apologize for the delay in response from my end. Thanks for clarifying it so well, i think a select is the best way to solve this problem. We have been working on adding this in the table -

I hope this helps, the menu button also we can add but in your case select looks more ideal than this.