Changed value of select dropdown in table column

Is it possible to update the current displayed value in table column of type Tag (dropdown)? For example, a user enters a code column A in a table, I want to change the value of the dropdown in column B such that it's id matches the code entered in column A. I can get the code entered, I can change the value in recordUpdates for the tag dropdown in column B but, the displayed value does not change. How can I get to and alter the selection of the list in column B. The use case is the ability to select a an item in a select list by either entering the Id, or the Value. Thanks.

If you can post a screenshot along with sample data for the table it will go a long way in helping you reach a solution from forum members.

I have a grid that looks like image below. Each item in the select list has a code (the Id) that maps to the value, e.g., { CEO; Chief Executive Officer} {ACCE; Account Executive},{AMGR; Account Manager} and so on. Some people know the code, others the value.

We have experimented with adding the code prior to the value in the list but due to the nature of the codes this not a good solution for the users.

What has been proposed is adding a separate column to the table that contains a text field that a user could type the code into. That value is then used to update the select list to the matching value.

Because the select list is in a table I am not sure how to get to the underlying control. I can set the displayed value by using setData on the table but after doing that the changes for that row in updateRecord are dropped.

Any ideas how either access the underlying select list in the table or any alternatives?

adding a separate column to the table that contains a text field that a user could type the code into. add a custom column (let's call is code) that is editable

That value is then used to update the select list to the matching value.
To do this, you would need to do two things
1. Upon Save Changes you will need to take that value(code) and rebuild the dropdown list
2. Then run the query that gets the data for the table

The question is if you want to keep the code that the user enters or not, and if not you can store that code in a temporary state variable and store code entered by the user like {{table1.selectedRow.data.*code*.}}

Thanks for the suggestions but it doesn't do exactly what I need. I want to be able to change the displayed value in the select list based on what code is entered by the user in the text box on exit (of text box). Is there a way to get to the underlying select list values such that I can change the list value? I don't want to have to save anything until user is done editing all rows and explicitly calls a save. I don't need to save the entered code in the textbox.

Since the table contains the select list and the "code" is entered in the same table in another column, you could do the following in the column containing the select list column:

Add {{currentRow.code}} in the Mapped value field

You might need to account for the fact that someone has yet to fill in the code, will that be an issue?
Is the dropdown field always pre-populated with a selected value?

To answer your questions, yes, each row will have the 'code' textbox prepopulated with the code that matches the current item in the select list when the table is rendered.

I think I am following but the select list does not have a Mapped value, it has Option value and Option label. I tried both of them using the currentRow value without success. Am I misunderstanding what you are suggesting? Thanks for the help.

What type column is that select list?
Screen Shot 2022-09-15 at 10.23.11 AM

Tag.

Can you post the JSON (a sample of it if need be) for the CodeDirBusinessTitle.data?

"id":["ACCT","ACMG","ACNT","ACONT","ACRM","ADDR","ADEAN",...]
"label":["Account Executive","Account Manager","Accountant","Assistant Controller","Accounts Receivable Manager","Advertising Director","Assistant Dean",...]

It is just a query that returns over 500 Id/label pairs

@pushbtn - Sorry for the delay, but I tried numerous ways of trying to find a solution... two things I ran in to:

  1. A custom column can't be used, so if you want a user to "write in a code", I was not able to make that work unless the column was already built into the table.
  2. The tag (dropdown) is a bit funky, and I believe that there are some ongoing issues with that field...you had to make it editable to account for the values and labels...AND...it seems too restrictive in terms of data types... but that's for support....
  3. Your Id value is a string and so the user would have to know what string to enter so the select dropdown would know which id to select... again this seems not possible because the data is set in the table.. so you might need to implement a temp state variable for the the dropdown in the row being selected (when the user is adding an Id in the table...which goes back to my original point about having to reload the table...

I finally got this to work but installing a checkbox. On the column definition, Datasource with fx set I toggle the id and label based on the cb value.
{
value: {{!cb.value ? LookupTable.data.Id : LookupTable.data.Label}},
label: {{!cb.value ? LookupTable.data.Label : LookupTable.data.Id}}
}
Then in the queries that save the data I do an LookupTable.data.indexOf(value) when using the id as the label, if the cb is true. I can toggle on the fly between the two modes.

Thanks for looking into this for us.