Hi, was looking the docs and other places but couldn’t find an answer to this.
I wanna extract all the data (or rather, get all the models) from a dataprovider. Something like:
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$dataProvider->getModels()
The problem with this, is that it only returns the models from the current page. I need to get all the models from the dataProvider. I think this can be done by setting the pagination property to false, like:
Tried to use what you mentioned but it’s giving me php fatal error (maximun execution time exceeded). I think this has more to do with my query than anything else, or maybe the $dataProvider has to many records.
This is the query that populates my $dataProvider:
I don’t really need to get the 30.000 IDs, but i would like to get the IDs in the grid after the user perfoms a search. Let’s say, grid returns 100 records after applying some filters, the grid shows 20 per page and i need to get all 100 IDs to perfom an action. Is a plain query the only way to do this? or this there any other way around it?
I thought about using a checkbox column to select all rows and get the IDs of the selected rows (using yii\grid\CheckboxColulmn) but i don’t know how to select all rows at once.
Thanks for your answer, will look further on that option.
I’m testing that right now. Problem with that is it limits the amount of records the user can perform the desired action with. Specifically, i want to send all the keys of the rows in the grid when the user clicks on a button so i can populate another table with those keys.
Will keep looking for other ways to do it, thanks for your help.
On a second thought checkbox column seems like a good solution, is there any way to select all rows across all pages in the gridview? I can select all checkbox in the current page via jQuery but don’t know how to select all checkbox in all pages at once. Was looking at this SO post but this uses jquery data tables, so i don’t know the proper way to implement it without it.
P.S: wasn’t sure if i should open a new issue for this so i ended up re-posting here. Sorry if it wasn’t correct.