Skip to main content

Posts

Showing posts from January, 2013

yii change sorting sort order by drag drop Creating a jQueryUI Sortable CGridView Yii Framework

The article below is copied from this URL  http://www.yiiframework.com/wiki/238/creating-a-jqueryui-sortable-cgridview/  . That linked article has a small error which i have removed here: ---------------------------------------------------------------------------------------- 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  class before starting this tutorial. Here are the basic steps to achieve this: Make sure your database table has a 'sortOrder' field. (Optional) Add the 'sortOrder' field to your Rules() function in your model Add the 'actionSort()' method to your controller to apply the sorting via ajax Add jQuery UI to your view that has the CGridView Setup the jQuery UI Code to work with the CGridView in question (Optional) Apply the sorting to your model's search() function if need be