You could store the list of all ids in session or db in the server action where api is called.
Then send a flag to the other server action which would execute the command on selected items that its a select all operation.
The data comes from an API, that is paginated, so we never return the whole list of ids unfortunately - otherwise the above would be a perfect option. I donât see any way other than another API call to get more IDs?
The question is misleading in that case.
It seems you have no control over the data being paginated or not.
So yes repeating calls is the way. Although its not a good solution, but what you can do is call API, and from result you can identify how many pages are there and then run a repeat step to call the same API multiple times.
Thanks Sid. I can see how that reads in a misleading way.
We are calling an API, 100âs of millions of records. We have full control over pagination, but only want to display a set number of records per page for obvious reasons - currently trying to handle this with a single additional api call.
Well if you have control over pagination, when you want to perform an operation on ALL results, you just need to retrieve complete data based on the flag sent from client side.
Not sure if the communication is clear here⌠but if the additional API call is working for you, then you should just use that.
Client side cannot in any way âselect allâ when it does not have the data. It can only be done on server side.
If you are performing an operation on all results, could you not set a checkbox field named âselectallâ?
It would make unticking individuals difficult unless you had an âexcludeâ array holding ids that had been deselcted.
When the form is processed, if selectall is set, the Server Action processing the form/data reads it and performs the database/API action on all (minus exclusions)?