Scripting Menu properties in a Matrix

Hi,

Semi-newbie here. Sorry if this is obvious in the documentation. I've been successful so far at finding answers that are close enough and adapting them to my template, but I've looked around and cant find the answer to this...and my JS skills are minimal, to say the least.

I have a matrix of 7 menus. I would like to know how to set the properties of each menu individually in the matrix:

-name
-layout

  • number of items in each menu
  • target, address, preArgs

thx!
GW

That would be by writing something like this in the props property:

// example for 3 switches in the matrix
var props = {}

var values = [
  ['a', 'b', 'c'], // 1st switch values
  ['d', 'e', 'f'], // 2nd 
  ['g', 'h', 'i'], // 3rd
]
var targets = [
  '127.0.0.1:4444', // 1st switch target
  '127.0.0.1:4445', // 2nd
  '127.0.0.1:4446', // 3rd
]

props.values = values[$] // $ = index of the item in the matrix
props.target = targets[$]

return props

Now using a matrix when the items have very different properties implies writing a lot of code and can get overcomplicated where creating 7 switch widgets is sometimes more straightforward,

awesome!! Thank you!