Sunday, May 29, 2011

CakePHP PaginatorHelper-Sorting problem solved

Hello Friends,
CakePHP provide its own Pagination helper using which you can easily add paging and sorting functionality in your CakePHP application. Using this helper class for one model, all instruction is given in below link. If you works with more than one model. means using belongsTo or hasMany relation and getting records from more than one table than paging is as simple as one table. But for sorting, you might face some problem. This can be solved by adding Model name before field name. Look at below syntax.

$paginator->sort(‘Title’, ‘Category.title’); ?>
If you find any problem in this than let me know by comment.


Post a Comment