From 5b65253349790db6dba4f95f59829484e5995f03 Mon Sep 17 00:00:00 2001 From: chandaniprajapati Date: Wed, 24 Feb 2021 14:26:47 +0530 Subject: [PATCH 1/2] react-datatable : Support for long lists (eg. if more thaa 5000 record in list) --- .../react-datatable/src/shared/service/SPService.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/samples/react-datatable/src/shared/service/SPService.ts b/samples/react-datatable/src/shared/service/SPService.ts index 8ee4c195e..69e62b05d 100644 --- a/samples/react-datatable/src/shared/service/SPService.ts +++ b/samples/react-datatable/src/shared/service/SPService.ts @@ -12,6 +12,8 @@ export class SPService { try { let selectQuery: any[] = ['Id']; let expandQuery: any[] = []; + let listItems = []; + let items: any; for (var i = 0; i < selectedFields.length; i++) { switch (selectedFields[i].fieldType) { case 'SP.FieldUser': @@ -28,9 +30,16 @@ export class SPService { break; } } - let listItems: any[] = await sp.web.lists.getById(selectedList).items + items = await sp.web.lists.getById(selectedList).items .select(selectQuery.join()) - .expand(expandQuery.join()).get(); + .expand(expandQuery.join()) + .top(4999) + .getPaged(); + listItems = items.results; + while (items.hasNext) { + items = await items.getNext(); + listItems = [...listItems, ...items.results]; + } return listItems; } catch (err) { Promise.reject(err); From 493989fdb6bf8d23adf75b53d85dd9688ed49c69 Mon Sep 17 00:00:00 2001 From: Hugo Bernier Date: Sun, 28 Feb 2021 11:39:06 -0500 Subject: [PATCH 2/2] Updated package solution version --- samples/react-datatable/README.md | 1 + samples/react-datatable/config/package-solution.json | 2 +- samples/react-datatable/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/react-datatable/README.md b/samples/react-datatable/README.md index 8d2be5e6e..d5698be43 100644 --- a/samples/react-datatable/README.md +++ b/samples/react-datatable/README.md @@ -40,6 +40,7 @@ react-datatable | Chandani Prajapati ([@Chandani_SPD](https://twitter.com/Chanda Version|Date|Comments -------|----|-------- 1.0|February 19, 2021|Initial release +1.1|February 24, 2021|Added support for large lists ## Disclaimer diff --git a/samples/react-datatable/config/package-solution.json b/samples/react-datatable/config/package-solution.json index fc6a33fe2..6615b7d45 100644 --- a/samples/react-datatable/config/package-solution.json +++ b/samples/react-datatable/config/package-solution.json @@ -3,7 +3,7 @@ "solution": { "name": "react-datatable-client-side-solution", "id": "35299377-f8c8-4721-bd53-05602fc0c4ee", - "version": "1.0.0.0", + "version": "1.1.0.0", "includeClientSideAssets": true, "isDomainIsolated": false, "developer": { diff --git a/samples/react-datatable/package.json b/samples/react-datatable/package.json index 47ecb5311..1b6411066 100644 --- a/samples/react-datatable/package.json +++ b/samples/react-datatable/package.json @@ -1,6 +1,6 @@ { "name": "react-datatable", - "version": "0.0.1", + "version": "1.1.0", "private": true, "main": "lib/index.js", "engines": {