Hey Guys,
I am having trouble with pagination. I have an index action:
/**
* Lists all models.
*/
public function actionIndex()
{
$model=new SWall;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['SWall']))
{
$model->attributes=$_POST['SWall'];
$model->user_id = Yii::app()->user->getId();
if($model->save())
{
Yii::app()->user->setFlash('success', 'Deine Nachricht wurde gespeichert.');
$this->redirect(array('view','id'=>$model->id));
}
}
// criteria
$criteria=new CDbCriteria(array(
'condition'=>'deleted=0',
'order'=>'updated_at DESC',
'with'=>array('commentCount', 'author'),
));
// dataprovider
$dataProvider=new CActiveDataProvider('SWall', array(
'pagination'=>array(
'pageSize'=>10,
),
'criteria'=>$criteria,
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
'model'=>$model,
));
}
in the view I have an update link like this:
<?php $url = Yii::app()->createUrl('/sWall/update?id='.$data->id); echo CHtml::link(CHtml::image(Yii::app()->baseUrl."/images/build-icons/_0018_Pencil.png"), $url, array('submit' => $url, 'class'=>'icon')); ?>
Now if I click on that link on page 1 it will work with any item and the item will be loaded for update properly. But if I go to page 2 and click on that link it will display the item from page one.
On page 1 I have items with Ids 11-20 and on page two I have items with Ids 1-10, if I click on the link for ID 1 it will display ID 11 for editing. However if I hover the link it displays the proper URL. Anybody has an idea what might be wrong there?
Any help is appreciated! Thanks in advance!
-Seb