|
<ejs-grid #grid='' [dataSource]='data' (actionFailure)='actionFailure($event)'>
....
</ejs-grid>
|
|
actionFailure(e: any): void {
console.log(e.error)
}
|
|
<ejs-grid #grid='' [dataSource]='data' (actionFailure)='actionFailure($event)'>
....
</ejs-grid>
|
|
actionFailure(e: any): void {
console.log(e.error)
}
|
When I try posting with postman if i pass an empty ("id": null) id it works, if I pass an empty string ("id": "" ) it fails.
Is there any way to intercept the datamanager save event (if any, I couldn't find an API published for the datamanager ) and modify the object to be saved on the fly?
Actually I just noticed that not all the DTO properties are passed back...
Further debugging the issue seems to be that the odata api expects a guid or null and the grid or data manager send an empty string. Furthermore there are some properties wich are arrays of strings or objects (like the additionalPictures property)
and if empty they get sent back as a n empty string rather than an empty array. How do I fix this?
Cheers,
|
import { Column, EditSettingsModel, ToolbarItems, IEditCell } from '@syncfusion/ej2-ng-grids';
<ejs-grid [datasource]='data' [editsettings]='editSettings' [toolbar]='toolbar' height='273px'>
<e-columns>
<e-column field='OrderID' headertext='Order ID' textalign='Right' [edit]='dpParams' isprimarykey='true' width=100></e-column>
<e-column field='CustomerID' headertext='Customer ID' width=120 [edit]='dpParams'></e-column>
. . .
</e-columns>
</ejs-grid>
[app.component.ts]
. . .
export class AppComponent implements OnInit {
public dpParams: IEditCell;
ngOnInit(): void {
. . .
this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true };
this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
this.dpParams = {
read: () => {
const value = !args.value? null: args.value;
return value;
},
} |


