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(

            'totalItemCount'=>$count,

            'id'=>'myDataProvider',

            'keyField'=>'tid', 

            'sort'=>array(

                'attributes'=>array( 

                     'tqty',

                ),

            ),

            'pagination'=>array(

                'pageSize'=>10,

            ),

        ));




        return $dataProvider;



This is the action used in my controller


        $model=new Ibltwo('search');

        $model->unsetAttributes();  

        if(isset($_GET['Ibltwo']))

            $model->attributes=$_GET['Ibltwo'];


        $this->render('index',array(

            'model'=>$model,

        ));

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


 

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

    'id'=>'ibl-grid',

    'dataProvider'=>$model->getSqlDataProvider(),

    'selectableRows'=>2, 

    'columns'=>$colArray,

));




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


.

.

array(

        'name'=>'tqty',

        'value'=>'strip_tags($data[\'tqty\'])',

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

        'type'=>'raw',

        'htmlOptions'=>array(

            'style'=>'text-align:right;',

        )),

.

.



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-


.../index.php?r=ibltwo/index&sort=tqty

After clicking the column sort heading,

link when mouse-over on same heading-


.../index.php?r=ibltwo/index&ajax=ibl-grid&sort=tqty.desc

Mouse-over on page 2 button-


.../index.php?r=ibltwo/index&ajax=ibl-grid&sort=tqty&myDataProvider_page=2

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.