示例#1
0
        private void LocalDataSourceProvider_PrepareDescriptionForField(object sender, PrepareDescriptionForFieldEventArgs e)
        {
            if (e.DescriptionType == DataProviderDescriptionType.Group)
            {
                var description = e.Description as Telerik.Pivot.Core.PropertyGroupDescription;

                if (description != null)
                {
                    if (e.FieldInfo.DisplayName == "Salesperson")
                    {
                        var menCalculatedItem = new MenAverageSales();
                        menCalculatedItem.GroupName = "Average Sales (Men)";
                        menCalculatedItem.SolveOrder = 3;
                        description.CalculatedItems.Add(menCalculatedItem);

                        var womenCalculatedItem = new WomenAverageSales();
                        womenCalculatedItem.GroupName = "Average Sales (Women)";
                        womenCalculatedItem.SolveOrder = 1;
                        description.CalculatedItems.Add(womenCalculatedItem);
                    }
                    else if (e.FieldInfo.Name == "Country")
                    {
                        var caCalculatedItem = new CA();
                        caCalculatedItem.GroupName = "CA";
                        caCalculatedItem.SolveOrder = 2;
                        description.CalculatedItems.Add(caCalculatedItem);
                    }
                }
            }
        }
        private void LocalDataSourceProvider_PrepareDescriptionForField(object sender, PrepareDescriptionForFieldEventArgs e)
        {
            if (e.DescriptionType == DataProviderDescriptionType.Group)
            {
                var description = e.Description as Telerik.Pivot.Core.PropertyGroupDescription;

                if (description != null)
                {
                    if (e.FieldInfo.DisplayName == "Salesperson")
                    {
                        var menCalculatedItem = new MenAverageSales();
                        menCalculatedItem.GroupName  = "Average Sales (Men)";
                        menCalculatedItem.SolveOrder = 3;
                        description.CalculatedItems.Add(menCalculatedItem);

                        var womenCalculatedItem = new WomenAverageSales();
                        womenCalculatedItem.GroupName  = "Average Sales (Women)";
                        womenCalculatedItem.SolveOrder = 1;
                        description.CalculatedItems.Add(womenCalculatedItem);
                    }
                    else if (e.FieldInfo.Name == "Country")
                    {
                        var caCalculatedItem = new CA();
                        caCalculatedItem.GroupName  = "CA";
                        caCalculatedItem.SolveOrder = 2;
                        description.CalculatedItems.Add(caCalculatedItem);
                    }
                }
            }
        }