@@ -253,38 +253,29 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
253253 * in the second argument of the data provider callback:__
254254 *
255255 * ```javascript
256- * grid.dataProvider = function(params, callback) {
257- * const url = 'https://api.example/data' +
258- * '?page=' + params.page + // the requested page index
259- * '&per_page=' + params.pageSize; // number of items on the page
260- * const xhr = new XMLHttpRequest();
261- * xhr.onload = function() {
262- * const response = JSON.parse(xhr.responseText);
263- * callback(
264- * response.employees, // requested page of items
265- * response.totalSize // total number of items
266- * );
267- * };
268- * xhr.open('GET', url, true);
269- * xhr.send();
256+ * grid.dataProvider = ({page, pageSize}, callback) => {
257+ * // page: the requested page index
258+ * // pageSize: number of items on one page
259+ * const url = `https://api.example/data?page=${page}&per_page=${pageSize }`;
260+ *
261+ * fetch(url)
262+ * .then((res) => res.json())
263+ * .then(({ employees, totalSize }) => {
264+ * callback(employees, totalSize);
265+ * });
270266 * };
271267 * ```
272268 *
273269 * __Alternatively, you can use the `size` property to set the total number of items:__
274270 *
275271 * ```javascript
276272 * grid.size = 200; // The total number of items
277- * grid.dataProvider = function(params, callback) {
278- * const url = 'https://api.example/data' +
279- * '?page=' + params.page + // the requested page index
280- * '&per_page=' + params.pageSize; // number of items on the page
281- * const xhr = new XMLHttpRequest();
282- * xhr.onload = function() {
283- * const response = JSON.parse(xhr.responseText);
284- * callback(response.employees);
285- * };
286- * xhr.open('GET', url, true);
287- * xhr.send();
273+ * grid.dataProvider = ({page, pageSize}, callback) => {
274+ * const url = `https://api.example/data?page=${page}&per_page=${pageSize }`;
275+ *
276+ * fetch(url)
277+ * .then((res) => res.json())
278+ * .then((resJson) => callback(resJson.employees));
288279 * };
289280 * ```
290281 *
0 commit comments