Add more than two elements to 'multiple select' cell from Javascript script

I’m having trouble adding more than 2 elements to a ‘Multiple Select’ programatically via a Javascript Script.

Does anyone know how to do it? It doesn’t work if I push to an array. It doesn’t work either if I add a " string" to its content.

Thanks in advance

Welcome to the SeaTable Forum.

Are you using the JavaScript in the web UI, or are you just using JavaScript to manipulate the API? As the former doesn’t support adding multiple select options (you can only fill in these cells if the options are already created). With the SeaTable API you can add multiple select options according to this article.

If you like, you can post your code here.

I just tested it with a button and it worked.

My script is as follows, with the options “1”, “2”, “3” and “4” already created in the table.

const table = base.getActiveTable();
const row = base.context.currentRow;

base.modifyRow(table, row, {'Multiple select': ['1', '2', '3','4']});

If any option doesn’t already exist, it will be ignored.

Thank you! I’ll create the options first, run the scripts later! Extremely appreciated!

You are welcome! Let me know then if it works for you.

As this is not a bug, I’ve moved this topic to Tips & Tricks.

Thank you, it worked perfectly.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.