Custom pagesize selection for CgridView Pagination

Hi guys Firstly, I wanna display the data from db through


Cgridview

with Pagination.and I did it.

Now I have to provide


select

box that user can select the


pagesize

for the


cgridview

.And I did the following




CHtml::dropDownList('pageSize',$pageSize,array(5=>5,10=>10,20=>20,50=>50,100=>100),

      		array('class'=>'adm-srchdrp','style'=>'padding:2px;height:26px;width:95px',

							'prompt'=>'PageSize',

 			'onchange'=>"$.fn.yiiGridView.update('family-record-grid',

 																						{

                type:'POST',

                url:$(this).attr('href'),

           	data:{pageSize:this.value },

           	success:function(data) {

           	$.fn.yiiGridView.update('family-record-grid');

                          }

                 	})";

      																					

 	)); 

but when i select the


pagesize

from


select 

box …it shows the error as


$.param.querystring

is not a function in console…

where I did mistake ? please suggest me in the right way…thanks for reading…

Have another look at the code you got from this post.

Your code is missing a number of items near "onchange". (Also scroll to the right side of your code block and remove tabs/spaces.)

Thank You sir for reply…

But I had given the "pageSize" values in select box and given the data as the selected value from select box.

Sir,does it mean number of records equals to total record retrieved from database…?

and I have one solution …

i.e.

Why can't we write a function for onchange of select box and pass it to a javascript function and 


in that javascript function reload the same page with the pageSize value as params ,which is selected from select box  as shown below..

in view




function pageData()

{

	var pageSize=document.getElementById("pageSize").value;

	window.location.href="index.php?r=registration/searchandprocessregistration&pageSize="+pageSize;

}

Here pageSize => id of select box

	and reload the same view by passing pageSize as params..

and in the controller





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

		$pageSizeInputValue = Yii::app()->request->getParam('pageSize', (int)$_GET['pageSize']);

		else 

			$pageSizeInputValue = Yii::app()->request->getParam('pageSize', 20);

    


$dataProviderRegSum = new CSqlDataProvider($rawData, array(

				'keyField' => 'FamilyId',

				'totalItemCount' => $count,

				'sort'=>array(

						//'defaultOrder' => 'CreatedDate desc',

						'defaultOrder' => 'familyid',

						'attributes'=>array(

								'RegistrationID'=>array(

										'asc'=>'familyid',

										'desc'=>'familyid DESC',

								),

								'PersonID'=>array(

									'asc'=>'PersonID',

									'desc'=>'PersonID DESC',

								),

							    

								'FirstName'=>array(

										'asc'=>'firstname',

										'desc'=>'firstname DESC',

								),

								'LastName'=>array(

										'asc'=>'lastname',

										'desc'=>'lastname DESC',

								),

								'CreatedDate'=>array(

										'asc'=>'CreatedDate',

										'desc'=>'CreatedDate DESC',

								),

								'EmailedDate'=>array(

										'asc'=>'EamiledDate',

										'desc'=>'EamiledDate DESC',

								),





						),),

			//	'pagination'=>array('pageSize'=>20)

				'pagination'=>array('pageSize'=>$pageSizeInputValue)


		));



it works …

but don’t know is it right way to do in framework…?

suggestion please sir…?