Because of list view threshold error, we planned to use the renderListDataAsStream method to query the SharePoint list. This works to get all the SP list items.
- How can we get paged results? Using for NextHRef ?Paged=TRUE&p_RequestDate=20210326 18:42:17&p_ID=243&PageFirstRow=101&View=00000000-0000-0000-0000-000000000000, we can get only the immediate next set of results. Can't we get random results based on page selected?
- To get filtered results based on search text, tried to pass a query string parameter-
var queryParams= new Map([["InplaceSearchQuery","xxx"]]);
return await sp.web.lists.getByTitle(spListName).renderListDataAsStream({
ViewXml: xml,
Paging: paging,
},null,queryParams).then((res) => { return res;
}); This does not work. How do we get filtered set? Do not want to store all the items in state and use that for filtering as it will be heavy. Please recommend any solution options.
CodePudding user response:
- Pagination works only for next page.
- I am using filtering (FilterField FilterValue) - https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest
React table using server filtering and pagination (still in slow development) - https://github.com/Matej4386/Sharepoint/tree/master/m_sptablev2
CodePudding user response:
I implemented a helper class for list item pagination using renderListDataAsStream, here is the package: https://www.npmjs.com/package/mgwdev-m365-helpers You can use SPListItemCamlPagedDataProvider class for list item pagination