Yes, that is exactly what i've done eventually:
public static class TypedListBaseExtender
{
public static IGroupByCollection GetDefaultGroupBy<T>(this TypedListBase<T> typedlist) where T : System.Data.DataRow
{
GroupByCollection g = new GroupByCollection();
foreach (IEntityField field in ((ITypedListLgp)typedlist).BuildResultset())
{
if (field.AggregateFunctionToApply == AggregateFunction.None) g.Add(field);
}
return g.Count > 0 ? g : null;
}
}
I figured i could use the ITypedListLgp interface to get to BuildRestulSet().
I can now do this:
DebtorGridViewTypedList debtors = new DebtorGridViewTypedList();
debtors.Fill(0, null, false, new PredicateExpression(DebtorFields.CompanyId == mycompanyid),null, debtors.GetDefaultGroupBy());