Cgridview Ajax Sort?

Hi all,

This has been driving me nuts, and well I guess a picture is worth a thousand words…

The column I’m trying to sort is a simple number, here are the results of the sort ascending:

and descending:

As you can see its not sorting properly… The only thing I can think of is the commas are messing it up somehow?

This is how I’m formatting the number:

'results' => number_format($obj->{'total_number_of_results'})

Any help or suggestions are appreciated!

So I removed the formatting from the numbers and the sorter works fine, but the large numbers are very difficult to read, any idea on how to format the numbers as above (i.e. 1,000,000,000 w/ thousands commas) and still have the sorter work?

Dear Friend

I hope the following is helpful.

In Model

public function afterFind()





in admin.php








Thanks seenivasan,

That seemed like the logical way to do it to me as well, however the ajax sort function does not work correctly when the data is formatted using number_format (see screen shots in first post)…

Still hoping to find a fix or workaround…