I apologize if this has been answered but I have searched and searched and nothing I have found has helped…
I have a program with the following flow:
Database of Customers. I search it and generate a result set
Display the result set in CGridView
Select the Customers I want to view in detail
Ajax Button calls the ‘customers/viewSelected’ controller action.
That controller action queries the Customer database for the selected records and creates a data provider with pagination set to 1 per page
Print a CListView in another div on the same page as the CGridView that displays the first record, with the pager widget.
Everything works fine up until now. I get the first record displayed in full in the CListView, and the pager widget appears in the div with the correct number of pages. But when I click on a page link to get page 2 or page 3, I get a blank result. No data, no pager.
Here is the code for the ajaxButton at the bottom of the CGridView:
echo CHtml::ajaxButton('View Customers', 'viewSelected',
array( 'type' => 'post',
'data' => 'js:{ids:$.fn.yiiGridView.getSelection("customerListGrid")}',
'update'=>'#custView' ));
Here is the controller customers/viewSelected:
public function actionViewSelected()
{
if(Yii::app()->request->isAjaxRequest){
if(isset($_POST['ids'])) {
$criteria=new CDbCriteria;
$criteria->together=true;
$criteria->with=array('leads','searches'); // ADD JOURNAL
$criteria->addInCondition('t.id',$_POST['ids']);
$pages=array('pageSize'=>1);
$dataProvider=new CActiveDataProvider('Customers',array('criteria'=>$criteria,'pagination'=>$pages));
$this->renderPartial('view',array('dataProvider'=>$dataProvider),false,true);
}
}
}
Here is the "view.php":
<h1>Customers</h1>
<?php
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'ajaxUpdate'=>'#custViewPanel',
'enablePagination'=>true,
'itemView'=>'_view',
));
?>
I appreciate any help in getting this working. Also, as I am an amateur teaching myself through this, I welcome any observations on the code or general advice.
Thank you.