Home > CakePHP, Php programming > CakePHP PaginatorHelper-Sorting problem solved

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 hasManyrelation 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.
Advertisements
  1. Sameer
    June 1, 2011 at 6:23 pm

    hi bhavin ..
    i want to know that how to add apply sorting on the field that is set of two field like total of price and discount “price+discount as p”

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: