I have a CListview which displays a list of products. I need to sort that list using location of the product. Product model has method getDistance() which calculates the distance between user and the product. Is there an easy way to achive that using CSort?
If you are using CActiveDataProvider
as data provider in your CListView
then you must calculate same distance value in SQL query (to be able to compare
and sort). If this is complicated, you can switch to CArrayDataProvider. where you can do your complex calculations and set them to model attributes.