Hi,
I use the pivot view component (React).
I would like to add a code in order to catch the errors from the backend.
This is my code :
getDataSourceSettings():IDataOptions {
...
let remoteData: DataManager = new DataManager({
url: ...
adaptor: new WebApiAdaptor,
...
});
let dataSourceSettings: IDataOptions = {
dataSource: remoteData as DataManager,
type: 'JSON',
...
};
return dataSourceSettings;
}
...
<PivotViewComponent
id='PivotView'
dataSourceSettings={this.getDataSourceSettings()}
....
The code works but my question is : where to add the code in order to catch errors from the backend api ?.
Thanks in advance !
Hi Jorge,
Please refer the below code example to catch the error.
Code Example:
|
let remoteData = new DataManager({ url: 'https://bi.syncfusion.com/northwindservice/api/orders', adaptor: new WebApiAdaptor(), crossDomain: true, }) .executeQuery(new Query()) //If there is any error in the backend, you can catch the error here. .then((e) => { pivotObj.dataSourceSettings.dataSource = e.result; });
|
Moreover, you can use the actionFailure event to catch the error of current UI action.
Meanwhile, we have prepared a sample for your reference.
Sample: https://stackblitz.com/edit/react-jpemrq-iy3jxs?file=index.js
Please refer the below UG document for how to render the Pivot table.
Document: https://ej2.syncfusion.com/react/documentation/pivotview/filtering/#actionfailure
Please let us know if you need further assistance with this.
Regards,
Angelin Faith Sheeba.
Hi,
I tried to add actionFailure in pivotViewComponent but it doesn't compile (others properties as drill, enginePopulated, toolbarRender works).
I use :
Any help is much appreciated.
Jorge
Hi Jorge,
ActionFailure event support is available from the version ( v19.4.38) in our pivot table component. So, please update your packages to the latest version to resolve the reported issue at your end.
Meanwhile, we have prepared a sample for your reference. Please find it from below link.
Sample: https://stackblitz.com/edit/react-bxebag?file=index.js
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba
Hi,
Thank you, with the following line in package.json it was possible to add the method actionFailure.
Regards,
Jorge
Hi Jorge,
Please let us know if you have any other queries. We are always happy to assist you.
Regards,
Angelin Faith Sheeba.