You can simply get the list of nodes with and without child items. Use the same methods in Grid and TreeGrid.