Skip to main content Skip to footer

Batch Updates in OdataCollectionView

Batch Updates

OData is an open protocol that allows the creation and consumption of queryable and interoperable RESTful APIs in a standard and straightforward way.

The ODataCollectionView class allows Wijmo applications to use OData data sources. It has always supported CRUD operations by committing changes (edits, adds, and deletes) immediately to the database. In the latest version, we added support for deferred batch updates.

To use this new feature, start by setting the deferCommits property to true. This will cause the ODataCollectionView to track any changes made to the data but will prevent any commits to the database until you call the commitChanges to commit the changes to the database or the cancelChanges method to discard the changes without committing them.

For example, the code below creates an ODataCollectionView with deferred commits, and handles two buttons that commit or cancel the changes:

// TripPinService (OData V4)  
 // [](  
 // [](  
 let url = '[…))/TripPinServiceRW/]('  
 let view = new ODataCollectionView(url, 'Airlines', {  
     keys: ['AirlineCode'], // entity keys are required to write data  
     deferCommits: true  

 document.getElementById('btn-commit').addEventListener('click', (e) => {  
     let btn = as HTMLInputElement;  
     btn.disabled = true;  
     view.commitChanges((xhr: XMLHttpRequest) => {  
         btn.disabled = false;  

 document.getElementById('btn-cancel').addEventListener('click', () => {  
Read the full Wijmo 2020 v1 release.

If you have something interesting that you want to bring to our attention, we would love to hear it!

Chris Bannon - Global Product Manager

Chris Bannon

Global Product Manager of Wijmo
comments powered by Disqus