CListView sorting Limitations


I have a question regarding the limitations of CListView’s sorting capabilities. I can sort on a models attribudes, ex id, name etc. Also if one has a relation, I can sort on ex. the id of the relation value. This is fine.

What I am currently struggling with is the following:

I have Shop which belongs to a business. The business has a many to many relationship with categories. The problem is when I list the shops, I want to sort on the different categories of the business. I want the different categories of the system in the sorting menu, and sort the shops on the categories.

Hm, hope this made sense, or please ask :slight_smile:

I hope someone has some experience with this who could shed some light for me?



You said you can sort by a relation’s field, so you should be able to sort shops by categories too :) You just need the “categoryId” field in the model and do all needed joins in the search() method.