jArchi folder path?

Started by Alberto, December 12, 2018, 16:32:10 PM

Previous topic - Next topic

Alberto

How do I retrieve the path of folders and name of a view or element via jArchi?

e.g. "Views\Folder 1\Folder 2\My Archimate View 1"    or "Business\Business Actor"


Phil Beauvoir

You can use .parents() on a collection. So, for example, if you select one node on the models tree ("selection"):



var path = "";

var parents = selection.parents();

for(i = parents.length - 1; i >= 0; i--) {
    path += "\\" + parents[i].name;
}

path += "\\" + selection.first().name;

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