I’m a beginner of yii2 framework. I’ve tried ActiveDataProvider in my env to access my sql database, and used GridView wiget to display data and do the pagination. Now I need to get data from APIs, and the APIs can give me the page info such as ‘page_size’, ‘page_number’ and ‘total_page’. My question is how can I rewrite ActiveDataProvider function to get data from APIs and realize the pagination function?
Or is there any other solution for my requirement?
Issue solved, I referred to ‘Creating Custom Data Provider’ section to rewrite ‘prepareModels()’, ‘prepareKeys()’ and ‘prepareTotalCount’ functions. All the data can be returned successfully by the APIs. Thank you very much!