/**
 * Handle post-grouping processing.
 * @var fields The fields that we grouped by.
 */
public void onGroupedBy(String[] fields)
{
	if (definitionBackedDataSource == null)
		return;

	//sort the groups if necessary
	if (fields != null && fields.length > 0 && fields[0] != null)
	{
		SortingDefinition groupSorting = definitionBackedDataSource.getGrouping().getGroupSorting();
		if (groupSorting != null && groupSorting.getColumnId() != null)
			new GroupSorter().sortGroups(CWListGrid.this, groupSorting.getColumnId(), groupSorting.getSortDirection());
	}

	/* With the extra column added for the grouping title, we need to dynamically resize the columns
	 * so it fits without needing a scrollbar.
	 */
	Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand()
	{
		@Override
		public void execute()
		{
			refreshFields();
		}
	});
}