Telerik Forums
Kendo UI for jQuery Forum
3 answers
276 views

I have a number of regular MVC grids that make their requests to controllers with additional data, and they make use of the Data attribute to call a function which returns an object. For example:

@(Html.Kendo().Grid<Model>()
                .Name("Grid")
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .ServerOperation(true)
                    .Read(read => read
                        .Action("ActionName", "ControllerName")
                        .Data("FunctionName")
                    )
                )

...and this works fine, but for the PivotGrid I can't seem to find a matching equivalent. The configuration seems to be quite different in fact:

@(Html.Kendo().PivotGrid<Model>()
                .Name("pivotGrid")
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Transport(transport => transport
                        .Read("Action", "Controller")
                    )
                    .Events(ev => ev.RequestEnd("onRequestEnd").RequestStart("onRequestStart"))

I cannot seem to use the same configuration (Transport instead of Read), and I cannot find anywhere the "Data" action can be assigned. I can set this attribute to the relevant javascript function after page load using:

$("#pivotGrid").data('kendoPivotGrid').dataSource.transport.options.read.data = pivotSync;

...but I would like to be able to set this during the initial configuration of the pivot grid. Is this possible?

Tom
Top achievements
Rank 1
Iron
 answered on 24 Apr 2017
3 answers
253 views

See attached files.

I have a pivot that is mostly functional, however clicking the column block either in the pivot grid or in the configurator indicates the columns can be sorted, but while the icon changes, nothing actually happens. This appears to be a bug.

I have also just noticed the same issue for row groups. The icon indicates there is sorting, but nothing happens.

Konstantin Dikov
Telerik team
 answered on 17 Apr 2017
8 answers
100 views
Hello,

How can change the title of the total (last rows) of the pivot grid?

In the image attached we can see I want to change with  mark in red.

thanks.
Viktor Tachev
Telerik team
 answered on 13 Apr 2017
1 answer
180 views

Hello,
I have pivot grid control and I'm trying to display several charts according to this pivot.
when the data is expanded the charts present correct data but when I start collapsing the columns the data in the charts starts freaking out and some of the data is missing and the other one is incorrect or displaying duplicated values.
I have tried the solutions proposed in the following thread:  but seems like it still doesn't work. 
any idea?
Please see the code below. 

functionloadPivotWWvsBoard() {
    $("#divPivot").html("");
    $("#divConfigurator").html("");
    var collapsed = {
        columns: [],
        rows: []
    };
    /*define the data source*/var DataSource;
 
    jQuery.ajaxSetup({
        async: false
    });
 
    $.get("/Report/GetDeliveredReportJSON", { fromWW: $("#FromWW").val(), toWW: $("#ToWW").val() }).done(function (data) {
        DataSource = data;
    })
 
    var dataSource = new kendo.data.PivotDataSource({
        data: DataSource
        , type: "xmla"
        , schema: {
            model: {
                fields: {
                    "Project": {
                        type: "string"
                    }
                    , Board: {
                        type: "string"
                    }
                    , WW: {
                        type: "string"
                    }
                    , "ApproveDate": {
                        field: "ApproveDate"
                        , type: "date"
                    }
                    , ReceiverName: {
                        field: "ReceiverName"
                    }
                    , RequestorName: {
                        field: "RequestorName"
                    }
                    , ApprovingManager: {
                        field: "ApprovingManager"
                    }
                    , PartTrans: {
                        field: "PartTrans"
                    }
                    , SerialNumber: {
                        field: "SerialNumber"
                    }
                    , OpeningDate: {
                        field: "OpeningDate"
                    }
                    , DeliveredDate: {
                        field: "DeliveredDate"
                    }
                    , ApprovalType: {
                        field: "ApprovalType"
                    }
                    , DateDifference: {
                        field: "DateDifference"
                    }
                    , ReportType: {
                        field: "ReportType"
                    }
                    , BusinessLine: {
                        field: "BusinessLine"
                    }
                    , Branch: {
                        field: "Branch"
                    }
                    , ManagerType: {
                        field: "ManagerType"
                    }
                    , CostCenter: {
                        field: "CostCenter"
                    }
                    , SapOrder: {
                        field: "SapOrder"
                    }
                ,
                }
            }
            , cube: {
                dimensions: {
                    "Project": {
                        caption: "Project"
                    }
                    , Board: {
                        caption: "Board"
                    }
                    , WW: {
                        caption: "WW"
                    }
                    , "ApproveDate": {
                        caption: "Approve Date"
                    }
                }
                , measures: {
                    "Delivered Quantity": {
                        field: "SerialNumber"
                        , aggregate: "count"
                    }
                }
            }
        }
        , columns: [{
            name: "Project", expand: true
        },
        {
            name: "Board", expand: true
        }]
        , rows: [{
            name: "WW"
        }]
        , measures: ["Delivered Quantity"]
    });
 
    dataSource.filter(loadFiltersForGrid(false))
    dataSource.fetch(function () {
        console.log("data source created successfuly", dataSource);
    });
 
    /*define the pivot*/var pivotgrid = $("#divPivot")
        .kendoPivotGrid({
            filterable: true,
            sortable: true,
            collapseMember: function (e) {
                var axis = collapsed[e.axis];
                var path = e.path[0];
 
                if (axis.indexOf(path) === -1) {
                    axis.push(path);
                }
            },
            expandMember: function (e) {
                var axis = collapsed[e.axis];
                var index = axis.indexOf(e.path[0]);
 
                if (index !== -1) {
                    axis.splice(index, 1);
                }
            },
            dataSource: dataSource
            , dataBound: function () {
                this.dataSource.expandColumn(["Project", "Board"]);
                this.dataSource.expandColumn(["Project"]);
                this.dataSource.expandRow(["WW"]);
                // this.dataSource.filter(filters);
                initChart(convertData(this.dataSource, collapsed, "Project"));
                initChart2(convertData(this.dataSource, collapsed, "Board"));
            }
        })
        .data("kendoPivotGrid");
 
 
    /*define the chart*/functioninitChart(data) {
 
        $("#divChart1").kendoChart({
            dataSource: {
                data: data,
                group: "column"
            },
            title: {
                text: "Delivered quantity by project"
            },
            legend: {
                position: "top"
            },
            seriesDefaults: {
                type: "bar"
            },
            series: [{
                type: "column",
                field: "measure",
            }],
            categoryAxis: {
                field: "row"
                , padding: {
                    top: 135
                }
                 , majorGridLines: {
                     visible: true
                 }
            },
            valueAxis: {
               majorGridLines: {
                    visible: true
                }
            },
            tooltip: {
                visible: true,
                format: "{0}",
                template: "#= series.name #: #= value #"
            },
            dataBound: function (e) {
                // e.sender.options.categoryAxis.categories.sort()
            }
        });
    }
    functioninitChart2(data) {
 
        $("#divChart2").kendoChart({
            dataSource: {
                data: data,
                group: "column"
            },
            title: {
                text: "Delivered quantity by board"
            },
            legend: {
                position: "top"
            },
            seriesDefaults: {
                type: "bar"
            },
            series: [{
                type: "column",
                field: "measure",
            }],
            categoryAxis: {
                field: "row"
                , padding: {
                    top: 135
                }
                 , majorGridLines: {
                     visible: true
                 }
            },
            valueAxis: {
                 majorGridLines: {
                    visible: true
                }
            },
            tooltip: {
                visible: true,
                format: "{0}",
                template: "#= series.name #: #= value #"
            },
            dataBound: function (e) {
                // e.sender.options.categoryAxis.categories.sort()
            }
        });
    }
}
 
functionflattenTree(tuples) {
    tuples = tuples.slice();
    var result = [];
    var tuple = tuples.shift();
    var idx, length, spliceIndex, children, member;
 
    while (tuple) {
        //required for multiple measuresif (tuple.dataIndex !== undefined) {
            result.push(tuple);
        }
 
        spliceIndex = 0;
        for (idx = 0, length = tuple.members.length; idx < length; idx++) {
            member = tuple.members[idx];
            children = member.children;
            if (member.measure) {
                [].splice.apply(tuples, [0, 0].concat(children));
            } else {
                [].splice.apply(tuples, [spliceIndex, 0].concat(children));
            }
            spliceIndex += children.length;
        }
 
        tuple = tuples.shift();
    }
 
    return result;
}
 
functionisCollapsed(tuple, collapsed) {
    var name = tuple.members[0].parentName;
 
    for (var idx = 0, length = collapsed.length; idx < length; idx++) {
        if (collapsed[idx] === name) {
            console.log(name);
            returntrue;
        }
    }
 
    returnfalse;
}
 
functionconvertData(dataSource, collapsed, type) {
    var columnTuples = flattenTree(dataSource.axes().columns.tuples || [], collapsed.columns);
    var rowTuples = flattenTree(dataSource.axes().rows.tuples || [], collapsed.rows);
    var data = dataSource.data();
    var rowTuple, columnTuple;
 
    var idx = 0;
    var result = [];
    var columnsLength = columnTuples.length;
 
    for (var i = 0; i < rowTuples.length; i++) {
        rowTuple = rowTuples[i];
 
        if (!isCollapsed(rowTuple, collapsed.rows)) {
            for (var j = 0; j < columnsLength; j++) {
                columnTuple = columnTuples[j];
 
                if (!isCollapsed(columnTuple, collapsed.columns)) {
                    if (idx > columnsLength && idx % columnsLength !== 0) {
 
                        var memebrtype;
                        if (type == "Board") {
                            memebrtype = 1
                        } else {
                            memebrtype = 0
                        }
                        var columninfo =  GetChildren(columnTuple.members[memebrtype], type);
                        if (columninfo) {
                            result.push({
                                measure: Number(data[idx].value),
                                column: columninfo,
                                row: rowTuple.members[0].caption
                            });
                        }
                       
                    }
                }
                idx += 1;
            }
        }
    }
 
    return result;
}
 
 
functionGetChildren(parent, type) {
    var result = undefined;
 
    if (parent.hasChildren || result != undefined) {
        for (var i = 0; i < parent.children.length; i++) {
            result = GetChildren(parent.children[i], type);
        }
    } else {
        result = parent.caption;
    }
    if (result == type) {
        result = undefined;
    }
 
 
    return result;
}

 

Tsvetina
Telerik team
 answered on 23 Mar 2017
1 answer
545 views

WordWrap is not happening in the column header of Kendo PivotGrid. I tried applying the following CSS to have word-wrap but it is not happening properly instead it is crossing the vertical column line and displayed in the next column. Instead my requirement is to display it in the next line of the same column.

Please find the snapshot for more details.

I tried applying following CSS to do wordwrap but it is not working 

.k-pivot .k-grid-header .k-header

{

    word-wrap: break-word !important; overflow: visible;

}

Any ideas what changes need to be done?

Tsvetina
Telerik team
 answered on 13 Feb 2017
6 answers
206 views

I want to sort rows and columns by values (not fieldnames).

One way to do that is like it's done by DevExpress (https://demos.devexpress.com/ASPxPivotGridDemos/OLAP/Browser.aspx + see attached screenshot). By right clicking a field i can choose for with field, row, column and measurement i want to sort. But even this solution could be more userfriendly.

Another more direct solution would be to sort by clicking on a measurement field or if there is only one, on a fieldname.

Both are just suggestions. But the functionality of sorting by values is really relevant.

I couldn't find any solution for this build-in in Kendo UI. Therefor this is a feature request/suggestion.

Robert
Top achievements
Rank 1
 answered on 02 Feb 2017
10 answers
414 views

Hello, I've been testing the PivotGrid using local data binding and have some questions:

Is there any way that I can make a button to expand all rows and columns with local data binding? I tried to do that in the column using

pivotgrid.dataSource.expandColumn("Dimension1&Value", "Dimension2");

but the grid's colspan was all wrong (see image attached). Is there any way to fix this? I tried to do the same thing on the row and it works fine.

Joey
Top achievements
Rank 1
 answered on 30 Jan 2017
3 answers
138 views

Hi,

we are using Pivot Grid kendo control with local binding. We have a datetime field in the data source but we are not able to get a datetime hierarchy for it in the pivot grid configurator component. In your demos for local binding there is no example using datetime fields while they are present in the remote binding demos. Is is still possible? Besides, we are noticing that measures only support sum aggregation natively. 

We used to work with Silverlight version of Pivot Grid where basic datetime hierarchy (e.g. day, month, year, etc.) and many measures aggregations (dropdown list that allowed to select for sum, count, etc.) for local binding weresupported, now we are porting that application to HTML5 and we are trying to get back as many functionalities as we can.

Thank you.

Viktor Tachev
Telerik team
 answered on 03 Jan 2017
4 answers
115 views

During testing of a system that uses Mondrian to create database cubes and KendoUI to generate dynamic MDX queries, it seems a cube using "CalculatedMember" is interpreted by KendoUI as "KPI". This is then listed as an item in "FIELDS". However, when clicking on this item, it is stuck in eternal loading while Mondrian logs an error for the query:

 

ERROR XMLAParser:113 - Method : XMLAResponseParser.parseFaultyResponse(String xmlaResponse), Mondrian Error : The Mondrian XML: No enum constant mondrian.xmla.RowsetDefinition.MDSCHEMA_KPIS
ERROR XmlaServlet:324 - Errors when handling XML/A message
mondrian.xmla.XmlaException: Mondrian Error:XMLA SOAP Body processing error
at mondrian.xmla.impl.DefaultXmlaServlet.handleSoapBody(DefaultXmlaServlet.java:511)
at mondrian.xmla.XmlaServlet.doPost(XmlaServlet.java:318)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at com.utel.stinga.spa.analytics.server.XmlaRequestFilter.doFilter(XmlaRequestFilter.java:119)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: No enum constant mondrian.xmla.RowsetDefinition.MDSCHEMA_KPIS
at java.lang.Enum.valueOf(Enum.java:236)
at mondrian.xmla.RowsetDefinition.valueOf(RowsetDefinition.java:54)
at mondrian.xmla.XmlaHandler.discover(XmlaHandler.java:2857)
at mondrian.xmla.XmlaHandler.process(XmlaHandler.java:671)
at mondrian.xmla.impl.DefaultXmlaServlet.handleSoapBody(DefaultXmlaServlet.java:507)
... 20 more

 

It seems Mondrian does not accept MDSCHEMA_KPIS. During further debugging, it seems KendoUI indeed sends this RequestType "MDSSCHEMA_KPIS":

 

Request Payload:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><Discover xmlns="urn:schemas-microsoft-com:xml-analysis"><RequestType>MDSCHEMA_KPIS</RequestType><Restrictions><RestrictionList><CATALOG_NAME>LTE</CATALOG_NAME><CUBE_NAME>LTE_10000</CUBE_NAME></RestrictionList></Restrictions><Properties><PropertyList><Catalog>LTE</Catalog></PropertyList></Properties></Discover></Body></Envelope>

 

Why do KendoUI interpret CalculatedMember as KPI? Why does KendoUI send request for MDSCHEMA_KPIS to Mondrian when this is not accepted?

S
Top achievements
Rank 1
 answered on 22 Dec 2016
1 answer
73 views

Hi, I am curious to learn about the difference between a Measure and a KPI in KendoUI.

Can anyone explain the detailed differences between Measures and KPIs?

Where could I see KendoUI documentation for KPI and Measures? I have tried searching and going through documentation, but nothing seems to mention this.

Georgi Krustev
Telerik team
 answered on 22 Dec 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?