I want to find the parents() for a archimate-diagram-model object

Started by Manj75, August 25, 2021, 15:17:10 PM

Previous topic - Next topic

Manj75

I want to be able to find that parent and parents of an object, but this is only supported on collections.

What I want to do is to find all the parents of a selected archimate-diagram-model, but this cannot be done on the object level - consider the following code:

var selectedViews = $(selection).filter("archimate-diagram-model") // returns a collection all selected views only

selectedViews.each(view) {
  console.log(">> view " + view.name + " " view.parents()) // This results in an error as view is an object and parents() is not a method of object
}

// However the parents() method only works on the collection
selectedViews.parents()  // This works but it shows all the listed parents for all the selected views and it's not simple to determine for which view the parents listed is for.


Any suggestions would be most welcome.

Jean-Baptiste Sarrodie

Hi,

As you've seen, this is only supported on collections, so simply create a collection containing your object.

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Phil Beauvoir

Quote from: Jean-Baptiste Sarrodie on August 25, 2021, 20:23:09 PM
Hi,

As you've seen, this is only supported on collections, so simply create a collection containing your object.

Regards,

JB

Indeed.

$(view).parents()
If you value and use Archi please consider making a donation. :-)
https://www.archimatetool.com/donate