Building on the Grid Quick Start example, you can create an AjaxDataView object, and bind to it using the grid's data option.
Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> require(["wijmo.wijgrid", "wijmo.data.ajax", "knockout.wijmo"], function () { $(document).ready(function () { $("#wijgrid").wijgrid({ data: new wijmo.data.AjaxDataView("http://ws.geonames.org/searchJSON", { ajax: { dataType: "jsonp", data: { username: "wijmowidgets", style: "SHORT" } }, pageSize: 10, onRequest: function (settings, shape) { settings.data.startRow = shape.pageSize * shape.pageIndex; settings.data.maxRows = shape.pageSize; }, onResponse: function (response) { return { totalItemCount: response.totalResultsCount, results: response.geonames }; } }), allowPaging: true }); }); }); </script> |