Revision #2 has been created by blindMoe on Sep 19, 2011, 8:49:14 PM with the memo:
Adjusted Step #2 to be Optional
« previous (#1) next (#3) »
Creating a jQueryUI Sortable CGridView
sortable, cgridview, jqueryui
I have had to do this a couple of times now so I figured I would share it with the community. I am going to keep this short because I really hope that you are familiar with [jQueryUI's Sortable](http://jqueryui.com/demos/sortable/ "jQueryUI's Sortable") class before starting this tutorial.
Here are the basic steps to achieve this:
1. Make sure your database table has a 'sortOrder' field.
2. Add the 'sortOrder' field to your Rules() function in your model
3. Add the 'sort()' function to your controller to apply the sorting via ajax
4. Add jQuery UI to your view that has the CGridView
Add this line to the model who's items you are sorting.
Without this line your item's sortOrder will never be saved:
array('sortOrder', 'numerical', 'integerOnly'=>true),