Currently I'm using the yii2 array dataprovider
for listing the datas from rest api. We have more than 10k records. Each rest api call can get only maximum 100 records
, If we want more i need to give the limit and offset for this rest api call.
Is there any specific rest api dataprovider in yii2? else how can i implement pagination for this rest API?
dataprovider
, inYii2
has support for pagination. Suppose, your service receives it's params with the following code:You could include
page
parameter in the request, and then do a little hack (:P), like :Once you do that, your
dataprovider
automatically assigns the value of$_GET
to it's result set. An example of dataprovider:Or, in your case:
To get the models, you could use
getModels()
method ofdataprovider
like following:Let me know if that solves your problem.