Archi Forum

Archi Plug-ins => jArchi => Topic started by: Manj75 on August 25, 2021, 15:17:10 PM

Title: I want to find the parents() for a archimate-diagram-model object
Post by: Manj75 on August 25, 2021, 15:17:10 PM
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.
Title: Re: I want to find the parents() for a archimate-diagram-model object
Post by: 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
Title: Re: I want to find the parents() for a archimate-diagram-model object
Post by: Phil Beauvoir on August 25, 2021, 21:04:40 PM
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()