hi there ,
here I have to use custom SQL command to take RATE of users ,
$sql="SET @rank=0";
$sql2 = "
SELECT @rank := @rank +1 AS rank, userId, result, testId,nameAndFam,ip,tryCount
FROM tbl_testlog, user
WHERE (
tbl_testlog.userId = user.id and testId =".$tId." AND ip='".$ip."'
)
ORDER BY result DESC
";
Yii::app()->db->createCommand($sql)->execute();;
$command=Yii::app()->db->createCommand($sql2);
$topUsers=$command->queryAll();
and the pass the result to CArrayDataProvider
$arrayDataProvider=new CArrayDataProvider($topUsers, array(
and then to the dataGird menu …
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'test-grid',
'dataProvider'=>$arrayDataProvider ,
finally I want to sort and filter the column,
I used some code like :
$arrayDataProvider=new CArrayDataProvider($topUsers, array(
'id'=>'id',
'keyField' => 'userId',
'pagination'=>array(
'pageSize'=>50,
),
'sort'=>$sort
));
but the sort just apply once …
I want custom sort link in top as like as default dataGridview …
thanks in advance .