How to paginate a web service API DataSource
I have created a DataSource to interact with an external web service API. Along with the requested data, the web service returns a field showing the total available rows and you can send start and limit parameters in the request, so pagination should be OK.
However I can't find any documentation on how to do pagination with a datasource...
I've figured out enough to create paginateCount and paginate methods in the model - however paginateCount doesn't receive the 'limit', 'page' or 'offset' parameters.
It looks like these are getting lost in the paginate method of the core controller.php (line 1063) when the variable $extra is created.
Is this a bug, or how should I get access to these variables in my model?
Asked by richardwo, on 9/2/10
1 Answer
use this examlpe to do the pagination http://blog.loadsys.com/2009/06/19/cakephp-rss-feed-datasource/
Answered by dogmatic69on 9/2/10
Thanks - their example shows a good approach to pagination, but it didn't allow sorting using the pagination helpers in the view. I've taken their approach and a few others and applied it to the twitter example from the cookbook to come up with something that allows paging and sorting: http://www.willis-owen.co.uk/wp/?p=81
richardwo - on 12/2/10
Rating
0
Viewed
2085 times
Last Activity
on 12/2/10






