diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 0fc8e6514b..200788cd61 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3094,6 +3094,14 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData if ( !parentNode ) return false; + // If the parent has not children then just mask it as container and return. + // Nodes will be initialized in Expand(). + if ( !parentNode->HasChildren() ) + { + parentNode->SetHasChildren(true); + return true; + } + // If the parent has children but child nodes was not initialized then // the node is collapsed so just return as nodes will be initialized in // Expand().