Reload inspector choices

In my diagram I’m using an Inspector, and I set the property “group” to type: select, I want to update the choices in the selector of groups when I create a new group or delete one, in order to allow the user to reassign a node to a group that was recently created.

image
I mean this selector of groups in the inspector

For select elements, the choices property accepts a function. For example, in the DataInspector sample, there’s a property like this:

properties: {
  ...
  state: {
    show: Inspector.showIfNode,
    type: 'select',
    choices: (node, propName) => {
      if (Array.isArray(node.data.choices)) return node.data.choices;
      return ['one', 'two', 'three', 'four', 'five'];
    }
  }
  ...
}

You could have the choices function return an array of possible Group IDs.

It’s also possible to create your own inspector if you feel the need to make further customizations that aren’t supported by the DataInspector extension. It’s mostly meant to be a demonstration of some possibilities.

Thanks, that worked, I tried writing the name of a function in “choices”, but now I write the function in the Return part and that worked.