Why do STreeView sub-nodes not expand?

Hello everyone,

I’m using an STreeView and when I try to expand a node with children NOT on the root level it doesn’t work and won’t expand, neither with double-clicking nor using an SExpanderArrow.

The nodes contain valid children ( OnGetChildren returns the children and SExpanderArrow is visible).

I tried binding OnMouseDoubleClick event and call SetItemExpansion manually, but it doesn’t work either. However when using this event, IsItemExpanded returns true right after calling SetItemExpansion.

To create custom TreeRows and TreeNodes I used the SceneOutliner as a reference, and I don’t understand what I’m doing differently from it (I’m using STreeView as it is, I’m not inheriting from it, though).

Any help would be greatly appreciated.

Thanks.

I fixed this bug, which I had forgotten for a while:

Don’t dynamically create an array of children in the OnGetChildren method. Store the children nodes in a member variable and return it; OnGetChildren is just a getter.

Hey, you probably dont even remember becuase it was like 4 years ago, But do you think you can help me?
Im getting the same issues and I dont really understand what you mean by returnning the member variable

I had the same thing happen as OP. What I did is in my FItemInfo I added a member variable like this:

class FItemInfo
{
    TArray<TSharedPtr<FItemInfo>> Children;
};

, then OnGetChildren, I populate that array and also output the elements from it into the out array reference. Before I was only outputting the elements without keeping my own shared ptr of the children.

Can you tell me more details? Because I have the same problem

I did it!

We can’t do array operations in OnAddChildren()
We should declare a struct in .h,like this:

struct FDialogNameInfo
{
      FDialogNameInfo
      FDialogNameInfo(FString Name) : DialogId(Name){}

       FString DialogId;
       TArray<TSharedPtr<FDialogNameInfo>> Children;
};

TArray<TSharedPtr< FDialogNameInfo>>DialogTreeInfo

And then,We need to match the father and the child in the TreeItemSounce and DialogTreeInfo one by one.

Specifically, you can get an algorithm according to your data structure. The example in the engine can see SSkeletonSlotName.h and .cpp

Finally:

void FDialogRootCustomization::OnAddSubChildren(TSharedPtr<FDialogNameInfo> Info,TArray<TSharedPtr<FDialogNameInfo>>&OutChildren)

{
OutChildren = InInfo->Children;
}