Sort Doesn't Stick On Pagination

I’m having some difficulty getting pagination to work right after using sort on a column. What happens is after I sort a column and I attempt to move on to the next page, then the columns aren’t sorted anymore. It’s as if a call was made to the dataprovider without taking into consideration that I want to sort a column(the next page is exactly the same as the page when the sort is not used).

The model I’m using extends from CFormModel. Within this model I have a method called getSqlDataProvider().

$sql='SELECT TQTY as tqty, TPROD as tprod from ITHI';

        $dataProvider=new CSqlDataProvider($sql, array(













        return $dataProvider;

This is the action used in my controller

        $model=new Ibltwo('search');







And this is the code in my view file that displays the grid.


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






for $colArray, here's a small snippet of it( it's huge )






        'header'=>Yii::t('order', 'Order total'), 







Would appreciate any suggestions or help. :)

Some extra info that could be helpful in figuring this out. :)

The link that appears in browser when doing a mouse-over on:

Column sort heading-


After clicking the column sort heading,

link when mouse-over on same heading-


Mouse-over on page 2 button-


No sorting is happening when page 2 loads, it just displays as if sort was never used.

Also, when attempting to use the sort while on page 2, it does not work at all.