When a grid is setup with inline editing and paging, adding or editing a record and changing the current page WITHOUT clicking the Inline 'Update' or 'Cancel' buttons results in the data being updated within the datasource (as demonstrated by the 'change' event on the datasource being triggered) but without the correct operation. The 'cancel' and 'save' event on the grid are also not triggered.
This behavior is demonstrated by the following:
http://dojo.telerik.com/@djones/uKIjI/2
5 Answers, 1 is accepted
Hello Dustin,
Here is an example showing how to implement Kendo UI Grid CRUD operations using the local data, that I believe will be helpful:
http://docs.telerik.com/kendo-ui/web/grid/how-to/grid-localstorage-crud
Regards,Kiril Nikolov
Telerik
That example is irrelevant, it's using both incell editing and batch editing, neither of which my are use cases in my example.
My example is utilizing static data for simplicity, however my real use case is setup with services, both experience the same issue as stated in my original post.
Hello Dustin,
The edit mode is not relevant in this case. Both the create and update options arguments expect the updated data to be returned to the grid (same demonstrated in the linked example), while in your scenario you return just an empty array.
Regards,Kiril Nikolov
Telerik
Again, my example is just an example, and not intended to be the complete setup for production use.
If you run my example and watch the console output, you will note that the DataSource.Transport.Create and DataSource.Transport.Update methods are NEVER called with the below reproduction steps (they would be logged in the console output). So my previous statement still stands that your example is irrelevant, as the Create and Update methods never even used, regardless of the correctness of their usage in this example.
Reproduction steps:
- Run the page.
- Click the "Add new record button".
- Add some text to the newly created item (or don't, it doesn't really matter).
- DO NOT CLICK THE "Cancel" OR "Update" BUTTONS.
- Click the "Go to the next page" button.
- Note that the ONLY event triggered is the datasource change event with an undefined action. This is demonstrated by the console output "called datasource 'change' with 'undefined'".
- Click the "Go to the previous page" button.
- Note that the newly added (but not explicitly Cancelled or Updated) record still exists in the grid, and is no longer in Edit mode.
Hello Dustin,
This behavior is expected, as when you click the "Add new record" button and observable object is added to the dataSource array. This object will update when the grid fields are updated, and when you navigate to another page it is still kept in the dataSource current array. However if you call the read() method of the dataSource without actually saving the object, you will no longer see it in the grid.
Regards,Kiril Nikolov
Telerik