Hello again Team Telerik,
As I continue my project, a Pivot Grind with AngularJS at APS.Net Core, I have new difficulties. At the beginning, I was saving the strings of rows, columns and measures in a database as three different columns. But in this way, I couldn't save the "state", meaning the "expand", "filter", "sort" etc values. So I looked around for a persist state and I found that getOptions() and setOptions() are working for Kendo Grid, so I thought that it would work on Pivot Grid also. But after many tries with different methods, I think that it doesn't work, or I'm doing something clearly wrong. My goal is to save the state as one column in a database per user. So I need a "save" button and a "load" button. There is no need to give you my code for this. I just like to see a working example in the sample code, because I can't make it work even in this. Please, give me an example of saving and loading to/from a local var for the code below, so I can find out what I'm doing wrong...
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel=
"stylesheet"
href=
"styles/kendo.common.min.css"
/>
<link rel=
"stylesheet"
href=
"styles/kendo.default.min.css"
/>
<link rel=
"stylesheet"
href=
"styles/kendo.default.mobile.min.css"
/>
<script src=
"js/jquery.min.js"
></script>
<script src=
"js/angular.min.js"
></script>
<script src=
"js/kendo.all.min.js"
></script>
</head>
<body>
<div id=
"example"
>
<div ng-app=
"KendoDemo"
ng-controller=
"MyCtrl"
>
<div kendo-pivot-configurator k-height=
"580"
k-data-source=
"dataSource"
id=
"configurator"
class=
"hidden-on-narrow"
></div>
<div kendo-pivot-grid=
"pivot"
k-options=
"options"
id=
"pivotgrid"
class=
"hidden-on-narrow"
></div>
<div class=
"responsive-message"
></div>
</div>
</div>
<script>
angular.module(
"KendoDemo"
, [
"kendo.directives"
])
.controller(
"MyCtrl"
,
function
($scope){
$scope.dataSource =
new
kendo.data.PivotDataSource({
type:
"xmla"
,
columns: [{ name:
"[Date].[Calendar]"
, expand:
true
}, { name:
"[Product].[Category]"
} ],
rows: [{ name:
"[Geography].[City]"
}],
measures: [
"[Measures].[Reseller Freight Cost]"
],
transport: {
connection: {
catalog:
"Adventure Works DW 2008R2"
,
cube:
"Adventure Works"
},
read:
"//demos.telerik.com/olap/msmdpump.dll"
},
schema: {
type:
"xmla"
},
error:
function
(e) {
alert(
"error: "
+ kendo.stringify(e.errors[0]));
}
});
$scope.options = {
groupable:
true
,
sortable:
true
,
reorderable:
true
,
filterable:
true
,
columnWidth: 200,
height: 580,
dataSource: $scope.dataSource
};
})
</script>
<style>
#pivotgrid {
width: 70%;
}
.hidden-on-narrow {
display: inline-block;
vertical-align: top;
}
</style>
</body>
</html>
Thanks in advance for your time and help,
Regards,
Stelios