Multiple Measures

5 posts, 0 answers
  1. Erik
    Erik avatar
    7 posts
    Member since:
    Sep 2015

    Posted 04 Dec 2015 Link to this post

    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?
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 08 Dec 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Erik
    Erik avatar
    7 posts
    Member since:
    Sep 2015

    Posted 08 Dec 2015 in reply to Georgi Krustev Link to this post

    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

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 10 Dec 2015 Link to this post

    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
  6. Erik
    Erik avatar
    7 posts
    Member since:
    Sep 2015

    Posted 10 Dec 2015 in reply to Georgi Krustev Link to this post

    That did it.  Thanks for the support.
Back to Top
UI for ASP.NET MVC is VS 2017 Ready