Skip to content

how to listen list item change on inspector #2891

Answered by zbynekstara
falmko asked this question in Q&A
Discussion options

You must be logged in to vote

Hi falmko,

Unfortunately, the inspector always triggers a specific event name for changes in lists (like change:args/0/type) and not a generic one like what works in the when definition.

As a workaround, you can use the graph (or element) listener (see here for details: https://docs.jointjs.com/api/dia/Element/#change), check if the change is coming from inspector (i.e. opt.inspector is not undefined), and see what the original property path was via opt.propertyPath or opt.propertyPathArray (see here: https://docs.jointjs.com/learn/features/shapes/model-attributes#relationship-between-prop-and-attr-methods).

For example:

graph.on('change:args', (element, modifiedArray, opt) => {
    if (o…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by falmko
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants