1
votes

If I create a template in Sitecore that builds out a parent node with 2 child nodes and 4 grandchild nodes, is there any way to have all of those nodes open in the tree when I "insert" that newly created node in the content tree?

example;

-Parent
  -Child
    Grandchild
    Grandchild
  -Child
    Grandchild
    Grandchild

Currently when I insert a new multilevel template the tree focus jumps to that newly created template but it is closed.

example;

+Parent

1

1 Answers

1
votes

I assume by multi-level template you're referring to a branch template. If so, I recommend you create an event handler for perhaps item:saved or item:created. Make sure it only runs when the item is of this template. In the handler try something like the following code. It may not be exact but might get you started and you may need to make it more recursive depending on what it does:

string rootId = // get ID of root item in the new tree of items
string message = String.Format("item:refreshchildren(id={0})", rootId);
Sitecore.Context.ClientPage.SendMessage(this, message);