var pivotGridObj = new ej.pivotview.PivotView({
dataSource: {
values: [{ name: 'Sold', caption: 'Units Sold' }, { name:'Amount', caption: 'Sold Amount' }],
formatSettings: [{ name: 'Amount', format: 'N2' }],
}
});
pivotGridObj.appendTo('#PivotView'); |
<script>
var pivotGridObj = new ej.pivotview.PivotView({
dataSource: {
data: pivotData,
expandAll: false,
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }],
rows: [{ name: 'Country' }, { name: 'Products' }],
formatSettings: [{ name: 'Amount', format: 'N2' }],
filters: []
}
});
pivotGridObj.appendTo('#PivotGrid');
function loadCultureFiles(name) {
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json', 'currencies.json'];
var loadCulture = function (prop) {
var val, ajax;
ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false);
ajax.onSuccess = function (value) {
val = value;
};
ajax.send();
ej.base.loadCldr(JSON.parse(val));
ej.base.setCulture('en-IN');
ej.base.setCurrencyCode('INR');
};
for (var prop = 0; prop < files.length; prop++) {
loadCulture(prop);
}
}
document.addEventListener('DOMContentLoaded', function () {
loadCultureFiles('en-IN');
});
</script> |