microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
390 stars 341 forks source link

Download only downloads files from first page. #4036

Closed ILSua closed 1 month ago

ILSua commented 1 month ago

Version used v4.13.1

Describe the bug When downloading multiple files, across multiple pages, only the file(s) from the first page (or sometimes the page you are currently on) is downloaded.

To Reproduce Using Details List layout. 'Allow items selection', Allow multiple selection', and 'Enable download' are all enabled/toggled on. Show paging is enabled. Showing 10 items per page, and allow 5 pages in range. Hide navigation buttons (prev page, next page) - toggled off Hide first/last navigation buttons - toggled off Hide navigation buttons (prev, next, first, last) if they are disabled - toggled on

Expected behavior I would expect that if I select one file from page one of the results being displayed, and a file from page two of the results, then clicking download would download a zip with both files contained within.

Desktop (please complete the following information): Using Chrome (Version 129.0.6668.90)

Additional context You guys are legends. Appreciate this app and the versions that continue to improve!!

patrikhellgren commented 1 month ago

It will only download files that are selected on the current page. This is by design since the results layout only knows about the items on the current page and because of this the download button cannot know anything about the selected items on other pages.

ILSua commented 1 month ago

It will only download files that are selected on the current page. This is by design since the results layout only knows about the items on the current page and because of this the download button cannot know anything about the selected items on other pages.

But if I select a file on page one, then navigate to page 2 and select a file, then navigate back to page 1, that file is still selected. So it maintains my selection across multiple pages, but when clicking the download button, it will only download the file from the page that I am on when I click the download button.

patrikhellgren commented 1 month ago

The results webpart only knows about the items on the current page. When you go to another page the items are reset and it loads just the items to display the new current page. This is so that it shouldn’t keep to many items in memory at the same time and not load that much over the network in the same request. All selected items (just the item index) are on the other hand kept for all pages. This is just how it is designed and nothing to do about when using paging. If you would like to download items from the whole result set in one go then you need to show the whole list on one page. You could enable sticky headers for the details list and set a fixed height for the layout instead of having multiple pages and then scroll through the list to select the ones to download.