Yii Framework Forum: Clistview Issue - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Clistview Issue Clistview Pagination not working properly on a seperate div tag Rate Topic: -----

#1 User is offline   Ninad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 04-December 12

Posted 20 February 2013 - 02:02 AM

**I have displayed the search result in div tag using clistview with ajax. The view is displayed properly for the first time but when clicked on next button of the pager the view gets displayed improperly with the layout being changed please can anyone help**

**This is the code for the display of search result**
 <?php ?>
            <div class="search-box">
            		<?php $this->widget('zii.widgets.jui.CJuiTabs', 
            				array(
            					'htmlOptions' => array( 'style' => 'font-family: Verdana;font-size: 12px;' ),
            				
                				'tabs' => array(
            	        			'Doctor' => $this->renderPartial('application.modules.listing.views.doctorsearch._search',array(), TRUE),
            	        			'StaticTab 2' => array('content' => 'Content for tab 2', 'id' => 'tab2'),
            						'StaticTab 3' => array('content' => 'Content for tab 3', 'id' => 'tab3'),
            						'Jobs' => array('ajax' => Yii::app()->createUrl('Jobs/JobSearch/ShowForm')),
            	        			// panel 3 contains the content rendered by a partial view
            	        			//'AjaxTab' => array('ajax' => $this->createUrl('..')),
            						 // Get Content From Another page. Also Pass Parameter
            	        			//'Static View'=>'Content for tab 1',
                				),
            				    // additional javascript options for the tabs plugin
            				    'options' => array(
            				        'collapsible' => true,
            				    ),
            				    // set id for this widgets
            				    'id'=>'MyTab',
            				));
            	?>
            </div>
            <div id="search-results">
            
            </div>

**This is the view that renders the Clistview**
  <script>
            function showrResultNextPage(id, result){
            	//$("#other-widgets").hide();
            	$('#search-results').html(result);
            }
            
            
            </script>
            
            <?php 
            $this->pageTitle=Yii::app()->name . ' - ' . Yii::t('ui', 'Persons');
            
            enter code here
            
            $this->breadcrumbs=array(
            	Yii::t('ui','Persons'),
            );
            ?>
            
            <h2><?php echo Yii::t('ui', 'Persons'); ?></h2>
            
            <?php $this->widget('zii.widgets.CListView', array(
            	'dataProvider'=>$dataProvider,
            	'ajaxUpdate'=>true,
            'afterAjaxUpdate'=>'showrResultNextPage',
            	'template'=>'{sorter}{pager}{summary}{items}{pager}',
            	'itemView'=>'_view',
            	
            //'ajaxUpdate'=>'search-results', 
            	'pager'=>array(
            		'maxButtonCount'=>'3',
            	),
            	
            )); ?>
  

**This is the partial _view file**
     <div class="view">
            
            	
            
            	<b><?php echo CHtml::encode($data->getAttributeLabel('listingid')); ?>:</b>
            	<?php echo CHtml::encode($data->listingid); ?>
            	<br />
            
            	<b><?php echo CHtml::encode($data->getAttributeLabel('cityid')); ?>:</b>
            	<?php echo CHtml::encode($data->cityid); ?>
            	<br />
            
            </div>


**The Controller code to display search result in div tag**
<?php
    class DoctorSearchController extends Controller {
    	
    		
    		public $layout='polllayout';
    	
    	
    	
    	
    	
    	public function actionResult(){
    		
    
    		$model = new Listing();
    		 $dataProvider=new CActiveDataProvider('listing', array(
    			'pagination'=>array(
    			'pageSize'=>Yii::app()->params['pageSize'],
    			'pageVar'=>'page',
    			),
    				
    			));
    			$this->render('search_results',array(
    			'dataProvider'=>$dataProvider,
    			));
    	}
    
    	
    
    
    }
**
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users