Demo - ODataCollectionView
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.input.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.filter.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.odata.min.js"></script>
<div class="container">
<h1>
ODataCollectionView
</h1>
<p>
Wijmo includes an <b>ODataCollectionView</b> class that
extends <b>CollectionView</b> to provide support for
<b>OData</b> sources.</p>
<p>
<a href="https://www.odata.org/" target="_blanl">OData</a>
is an
<a href="https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=odata" target="_blank">OASIS standard</a>
that defines a set of best practices
for building and consuming RESTful APIs. OData helps you
focus on your business logic while building RESTful APIs
without having to worry about the various approaches to
define request and response headers, status codes,
HTTP methods, URL conventions, media types, payload formats,
query options, etc.</p>
<p>
To use the <b>ODataCollectionView</b> class, create a
new instance passing the URL of the data service, the
name of the table you want to access, any optional
parameters such as the fields you want to retrieve
and whether you want filtering, sorting, and paging
to be performed on the server or on the client.</p>
<p>
If your data source supports writing, make sure to
include the key fields as well.</p>
<p>
This example shows a list of Northwind customers
loaded from a public (read-only) OData...
CSS
.wj-flexgrid {
height: 300px;
}
body {
margin-bottom: 20pt;
}
JavaScript
onload = function() {
// get customer list from Northwind OData service
var url = 'https://services.odata.org/Northwind/Northwind.svc';
var customers = new wijmo.odata.ODataCollectionView(url, 'Customers', {
sortOnServer: true,
filterOnServer: true
});
// show the data on a grid
var itemCountElement = document.getElementById('itemCount');
var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
itemsSource: customers, // ODataCollectionView
isReadOnly: true, // this service is read-only
loadedRows: function() {
itemCountElement.innerHTML = theGrid.rows.length + ' items'
}
});
// add a filter to the grid
var f = new wijmo.grid.filter.FlexGridFilter(theGrid);
}