|
<div class="col-lg-3 property-section">
<table id="property" title="Properties" style="width: 100%">
<tbody>
<tr style="height: 50px">
<td>
@Html.EJS().Button("save").Content("SAVE").IsPrimary(true).Render()
</td>
</tr>
<tr style="height: 50px">
<td>
@Html.EJS().Button("load").Content("LOAD").IsPrimary(true).Render()
</td>
</tr>
</tbody>
</table>
</div>
<script>
document.getElementById("save").addEventListener('click', function () {
var pivotObj = document.getElementById('pivotview').ej2_instances[0];
var dataSource = JSON.parse(pivotObj.getPersistData()).dataSourceSettings;
dataSource.dataSource = [];
localStorage.pivotReport = JSON.stringify(dataSource);
});
document.getElementById("load").addEventListener('click', function () {
var pivotObj = document.getElementById('pivotview').ej2_instances[0];
var dataSource = JSON.parse(localStorage.pivotReport);
dataSource.rows = [];
dataSource.columns = [];
dataSource.values = [];
dataSource.filters = [];
dataSource.dataSource = [
{ 'Sold': 31, 'Amount': 52824, 'Country': 'France', 'Year': 'FY 2015' },
{ 'Sold': 51, 'Amount': 86904, 'Country': 'France', 'Year': 'FY 2015' },
{ 'Sold': 90, 'Amount': 153360, 'Country': 'Germany', 'Year': 'FY 2017' },
{ 'Sold': 25, 'Amount': 42600, 'Country': 'France', 'Year': 'FY 2015' },
{ 'Sold': 27, 'Amount': 46008, 'Country': 'Ausralia', 'Year': 'FY 2016' }];
pivotObj.dataSourceSettings = dataSource;
});
</script> |