collapseData(uniqueName: String)
[starting from version: 1.6]
Collapses all nodes of the specified hierarchy. Please note, this method works only for CSV and JSON data sources.
pivot.collapseData('Country');
Try on JSFiddle.
collapseAllDataexpandAllDataexpandData
In this guide