react-datatable : Support for long lists (eg. if more thaa 5000 record in list)
This commit is contained in:
parent
3fe547d840
commit
5b65253349
|
@ -12,6 +12,8 @@ export class SPService {
|
||||||
try {
|
try {
|
||||||
let selectQuery: any[] = ['Id'];
|
let selectQuery: any[] = ['Id'];
|
||||||
let expandQuery: any[] = [];
|
let expandQuery: any[] = [];
|
||||||
|
let listItems = [];
|
||||||
|
let items: any;
|
||||||
for (var i = 0; i < selectedFields.length; i++) {
|
for (var i = 0; i < selectedFields.length; i++) {
|
||||||
switch (selectedFields[i].fieldType) {
|
switch (selectedFields[i].fieldType) {
|
||||||
case 'SP.FieldUser':
|
case 'SP.FieldUser':
|
||||||
|
@ -28,9 +30,16 @@ export class SPService {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let listItems: any[] = await sp.web.lists.getById(selectedList).items
|
items = await sp.web.lists.getById(selectedList).items
|
||||||
.select(selectQuery.join())
|
.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;
|
return listItems;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Promise.reject(err);
|
Promise.reject(err);
|
||||||
|
|
Loading…
Reference in New Issue