Naveen
Naveen

Reputation: 67

TreePos in EA for elements

During creation of new elements in EA i tried to set the element position using Element.TreePos but after setting this still the element in EA is getting inserted based on the Alphabetical order. But once the project is reloaded it is getting arranged properly as per the TreePos.

EA.Element mobjElement= mobjParentelement.AddNew("","Requirement");
  mobjElement.Name= "Sample";
mobjElement.TreePos=1;
 mobjElement.Update();

Upvotes: 0

Views: 221

Answers (1)

Geert Bellekens
Geert Bellekens

Reputation: 13701

You have to reload before a change in TreePos becomes apparent.
You can use EA.Repository.RefreshModelView(long PackageID). According to the documentation the PackageID parameter should limit the reload to only the package with the given ID, but I have not found a difference between reloading a single package or reloading the whole model (using 0 as parameter).

Since v13 there is also EA.Repository.ReloadPackage(long PackageID) which might do what you need, but I haven't tested that myself. From the documentation it is not clear what the exact difference is between the two operations.

Upvotes: 1

Related Questions