<ej-pivot-client id="PivotClient1" render-success="successEvent">
// dataSource
</ej-pivot-client> |
function successEvent(args) {
if (args.model.dataSource.data== null) {
$.ajax({
//…
async: false,
success: function (data, status, xhr) {
pivotClient = $("#PivotClient1").data("ejPivotClient");
pivotClient.model.dataSource.data = val;
pivotClient._pivotSchemaDesigner.model.enableWrapper = true;
pivotClient._pivotSchemaDesigner._load();
pivotClient.refreshControl();
},
error: function (request, error) {
}
});
}
} |
<ej-pivot-client id="PivotClient1" render-success="successEvent" load="onLoad">
// dataSource
</ej-pivot-client> |
function onLoad(args) {
args.model.dataSource.data = [];
}
function renderSuccess(args) {
if (!ej.isNullOrUndefined(args.model.dataSource.data)) {
$.ajax({
type: "POST",
url: '@Url.Action("GetList", "Home")',
contentType: 'text/xml',
dataType: 'text',
data: "s",
async: true,
success: function (data, status, xhr) {
pivotClient = $("#PivotClient1").data("ejPivotClient");
pivotClient.model.dataSource.data = val;
pivotClient._pivotSchemaDesigner.model.enableWrapper = true;
pivotClient._pivotSchemaDesigner._load();
pivotClient.refreshControl();
},
error: function (request, error) { }
});
}
} |
<div>
<div id="target">
<ej-waiting-popup id="target" show-on-init="true" />
</div>
<div id="PivotClient1"></div>
</div> |
$(function () {
$.ajax({
type: "POST",
//…
success: function (data, status, xhr) {
$("#target").ejWaitingPopup("hide").remove();
$("#PivotClient1").ejPivotClient({
dataSource: {
//Datasource bound to PivotGrid control.
data: val,
//Required fields in row, column, value and filter areas of PivotGrid control.
rows: [
{
fieldName: "Country",
fieldCaption: "Country"
}
],
columns: [
{
fieldName: "Product",
fieldCaption: "Product"
}
],
values: [
{
fieldName: "Amount",
fieldCaption: "Amount"
}
]
}
})
},
error: function (request, error) { }
});
}); |