Create checkbox outside of CGridView, re-sort table (update)

Hello friends,

I am using yii only recently, please excuse my ignorance. I have a table with several columns, one of which is called “score”. The column “score” has several elements with the values from 10 to 0.0. I have to create several checkboxes which are positioned outside of my columns. As soon as this checkbox is clicked, the table has to sort the “scores” of, for example 10 - 9.0 without reloading the page. Next checkbox with the values 8.9 - 7.0, and so on. I’m sorry, I can’t go any further.

My view looks like this:

    $this->beginWidget('zii.widgets.grid.CGridView', array(


            'enablePagination' => true,

            'enableSorting' => true,

            'id' => 'vul-grid-view',

            'beforeAjaxUpdate' => 'saveSelectedRows',

            'afterAjaxUpdate' => 'checkPreviouslyChecked',

            'columns' => array(


                    'header' => 'Select',

                    'class' => 'CCheckBoxColumn',

                    'selectableRows' => 2,

                    'id' => 'selectId'







Can someone help me with that? I would be very happy. Many Thanks!

This should work for one checkbox. You will have to add the logic for multiple. Basically you refresh the gridview after you click on the checkbox. Between that you would need to implement code for your table sorting logic.

Yii::app()->clientScript->registerScript("myjqueryscript, "

 $('input:checkbox').change( function(){ // is the current checkbox checked

      if ( $(this).is(':checked') ) {

          // code to reorder table here

         $.fn.yiiGridView.update('vul-grid-view', { // refresh gridview

	   data: $(this).serialize()