This is a migrated thread and some comments may be shown as answers.

Multiple Measures

4 Answers 201 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 2
Erik asked on 04 Dec 2015, 01:34 PM
I have a pivot grid against flat remote data source that is based on the demo but when I try to add multiple measures at runtime only the first measure is displayed.  I can add additional measures from the configurator after page loads but I need the measures to show up on initial page load.  Is this possible?

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 08 Dec 2015, 10:01 AM
Hello Erik,

If the measures are defined correctly, then the widget will display them. Here is a Dojo demo, based on our online "Remote Binding" demo, that shows multiple measures correctly:

Regards,
Georgi Krustev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Erik
Top achievements
Rank 2
answered on 08 Dec 2015, 11:33 AM

Is it possible this does not work with the html helper or is my code flawed as I only get the last measure on the list at runtime:

            @(Html.Kendo().PivotGrid<MAM.Models.vw_SP>()
                .Name("pivotgrid")
                .Configurator("#configurator")
                .ColumnWidth(120)
                .Height(570)
                .BindTo(Model)
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Schema(schema => schema
                        .Model(model => model.Id(p => p.SpendPlanID))
                        .Cube(cube => cube
                            .Dimensions(dimensions =>
                            {
                                dimensions.Add(model => model.CostCodeName).Caption("All Cost Codes");
                                dimensions.Add(model => model.TaskOrderNum).Caption("Task Order");
                                dimensions.Add(model => model.SubsystemName).Caption("Subsystem");
                            })
                            .Measures(measures =>
                            {
                                measures.Add("Planned").Format("{0:c}").Field(model => model.PlanAmt).AggregateName("sum");
                                measures.Add("Funded").Format("{0:c}").Field(model => model.FundingAmt).AggregateName("sum");
                                measures.Add("Spent").Format("{0:c}").Field(model => model.EstAmt).AggregateName("sum");
                                measures.Add("Remaining").Format("{0:c}").Field(model => model.Balance).AggregateName("sum");
                            })
                        ))
                    .Columns(columns =>
                    {
                        columns.Add("CostCodeName").Expand(false);
                    })
                    .Rows(rows =>
                        {
                            rows.Add("TaskOrderNum").Expand(true);
                            rows.Add("SubsystemName").Expand(false);
                        })
                    .Measures(measures =>
                        {
                            measures.Values("Planned");
                            measures.Values("Funded");
                            measures.Values("Spent");
                            measures.Values("Remaining");

                        })
                    .Events(e => e.Error("onError"))
                )
            )

Thanks,

Erik

0
Georgi Krustev
Telerik team
answered on 10 Dec 2015, 09:42 AM
Hello Erik,

The MVC wrappers use, so called, Fluent Interface pattern. It is designed to set specific model option everytime the corresponding method is called. It will not combine values.

Based on the given information, any subsequent Values method call will override the previous set. If you would like to define a list of measures, set them as an array.

Regards,
Georgi Krustev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Erik
Top achievements
Rank 2
answered on 10 Dec 2015, 01:52 PM
That did it.  Thanks for the support.
Tags
PivotGrid
Asked by
Erik
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Erik
Top achievements
Rank 2
Share this question
or