I have a standard grid, and am trying to use the insert functionality. This works, but after inserting the record, it doesn't appear in the grid. I have to refresh the page to see the new record that's just been added.
<ej-grid id="datagrid" [allowSorting]="true" [allowPaging]="true" [dataSource]="gridData" [toolbarSettings]="toolbarItems" [editSettings]="editSettings">
<e-columns>
<e-column field="id" [visible]="false" [isPrimaryKey]="true"></e-column>
... etc ...
</e-columns>
</ej-grid>
export class MyComponent {
editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true};
toolbarItems = { showToolbar : true, toolbarItems : ["add", "edit", "delete", "update", "cancel"]};
constructor() {
this.datagrid = new ej.DataManager{
url: "/api/exampledata",
crossDomain: true,
adaptor: new ej.WebApiAdaptor(),
headers: [{
Authorization: "Bearer " + this.apiHelper.getToken()
}]};
}
}
(code above stripped down to show relevant bits)
Looking at Chrome dev tools - it's doing the POST request, then automatically doing a GET request to get all the results afterwards. These results do include the new record, but the grid doesn't get updated to include it.
Any ideas what I'm doing wrong?
Thanks for your help,
Dan