Merge pull request #1735 from chandaniprajapati/react-datatable-large-lists-support

This commit is contained in:
Hugo Bernier 2021-02-28 11:40:08 -05:00 committed by GitHub
commit 9018f7e1ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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": {

View File

@ -1,6 +1,6 @@
{
"name": "react-datatable",
"version": "0.0.1",
"version": "1.1.0",
"private": true,
"main": "lib/index.js",
"engines": {

View File

@ -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);