void SelectFirstDays(PivotGridGroup group) { foreach (object year in group.GetUniqueValues(null)) { PivotGroupFilterValue value = group.FilterValues.Values.Add(year); foreach (object month in group.GetUniqueValues(new object[] { year })) { value.ChildValues.Add(month).ChildValues.Add(1); } } }
private static FilterInfo[] GetConvertedFilerInfo(PivotGridGroup group, PivotGroupFilterValuesCollection filterValues, object[] parentValues) { if (!group.FilterValues.HasFilter || filterValues == null || filterValues.Count == 0) { return(new FilterInfo[0]); } var currentField = filterValues.Items[0].Field; var uniqueValues = group.GetUniqueValues(parentValues); var invertedFilterInfo = new List <FilterInfo>(); foreach (object v in uniqueValues) { PivotGroupFilterValue filterValue = filterValues.FirstOrDefault(fv => Object.Equals(fv.Value, v)); if (filterValue == null) { invertedFilterInfo.Add(new FilterInfo() { Field = currentField, Value = v }); } else { if (filterValue.ChildValues != null && filterValue.ChildValues.Count > 0) { invertedFilterInfo.Add(new FilterInfo() { Field = currentField, Value = v, ChildValues = GetConvertedFilerInfo(group, filterValue.ChildValues, (parentValues ?? new object[0]).Union(new object[] { v }).ToArray()) }); } } } return(invertedFilterInfo.ToArray()); }