How Can Keep Checked Row Selected During Pagination?

I am using pagination to view table rows. I want to select different rows from different pages and then submit the form.

But when I select different rows from a page and move to another page to select more then back to previous page again, I didn’t find already checked row there.

Here is my code-





<table class="table"> 	

  <tr> 		

   <th></th> 		

   <th>Name</th> 	

  </tr>	


 <?php	

 $j=0;   	

 foreach($datavalue as $datainarray)	

 { 		

  ?> 		

  <tr> 			

   <td> 				

      <input type="checkbox" id="item_id[<?php echo $j; ?>]" name="item_id[<?php echo $j; ?>]"  value="<?php echo $datainarray->attributes['item_id']; ?>">            	

   </td>          	

   <td>

 	<?php echo $datainarray->attributes['Name'];?></td> 		

  </tr> 		

  <?php    	

   $j++;  	

 } 	

  ?>

</table>  

<?php 	

  $this->widget('CLinkPager', 

   array(          'itemCount'=>$row_count, 		

    'pageSize'=>20, 		

    'maxButtonCount'=> 10,   	

   'nextPageLabel'=>'Next >>',   	

   'header' => '', 	));  	

?>



I have searched web to find a solution but I didn’t find a suitable solution.

Hoping to find suitable solution from experts.

Thanks

Hi,

I think good solution is to implement cgridview … can i know the reason. why u have tried to implement with ordinary tables :(

Thanks for your reply.

I want to select different rows inside a form and submit the form with all selected rows. I am not sure how do I achieve this using cgridview in a form. Would you please give me a rough idea about the solution.

Thanks

Hi,

Please go through following link…

maybe it can help you

https://mahincse.wordpress.com/2012/12/09/yii-cgridview-checkbox-check-value-get-for-deleted-those/comment-page-1/

http://stackoverflow.com/questions/10083616/submit-cgridview-checked-values-using-a-form

http://stackoverflow.com/questions/12923415/how-to-process-selected-rows-in-yii-cgridview

cheers

Thanks again…