Difference between #1 and #2 of
Creating a jQueryUI Sortable CGridView

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) »


Title unchanged

Creating a jQueryUI Sortable CGridView

Category unchanged


Yii version unchanged

Tags unchanged

sortable, cgridview, jqueryui

Content changed

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. (Optional) 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
**Step 2:** This step is optional but recommended.  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),
35 0
Viewed: 44 088 times
Version: 1.1
Category: How-tos
Written by: blindMoe
Last updated by: rAWTAZ
Created on: Sep 16, 2011
Last updated: 5 years ago
Update Article


View all history