chameera  
          
              
                December 17, 2013, 10:56am
               
              1 
           
         
        
          Hi All,
I am using a custom cridview class with bootstrap.widgets.TbTabs. Idea of using a custom class is to provide the on keyup search functionality. Issue is this functionality only works for the first tab. (In my case only for the ‘Countries’ tab).
My gridview:
class MyCGridView extends CGridView {
	public function init() {    	
    	$this->afterAjaxUpdate = "function(id, data){ afterAjaxUpdate(id, data);}";
    	parent::init();
	}
	public function registerClientScript() {  
   	Yii::app()->clientScript->registerScript('key_up_filter',"setupGridView('#".$this->getId()."');");
    	parent::registerClientScript();
	}
}
TbTabs configuration:
$this->widget('bootstrap.widgets.TbTabs', array(
    	'type' => 'tabs', // 'tabs' or 'pills'
    	'placement' => 'bellow',
    	'tabs' => array(
        	array('label' => 'Countries', 'content' => $this->renderPartial('_countries', $data_countries,true,true),'active'=>$tabselector['cs']),
        	array('label' => 'States/Provinces', 'content' => $this->renderPartial('_stateprovinces', $data_statesProvinces, true, true),'active'=>$tabselector['stp']),
        	array('label' => 'Universities', 'content' => $this->renderPartial('//university/index', $data_university,true, true),'active'=>$tabselector['uni']),
    	),
	));
Any idea what’s going on here?
         
        
           
         
            
       
      
        
        
          
 chameera:
 
Hi All,
I am using a custom cridview class with bootstrap.widgets.TbTabs. Idea of using a custom class is to provide the on keyup search functionality. Issue is this functionality only works for the first tab. (In my case only for the ‘Countries’ tab).
My gridview:
class MyCGridView extends CGridView {
	public function init() {    	
    	$this->afterAjaxUpdate = "function(id, data){ afterAjaxUpdate(id, data);}";
    	parent::init();
	}
	public function registerClientScript() {  
   	Yii::app()->clientScript->registerScript('key_up_filter',"setupGridView('#".$this->getId()."');");
    	parent::registerClientScript();
	}
}
TbTabs configuration:
$this->widget('bootstrap.widgets.TbTabs', array(
    	'type' => 'tabs', // 'tabs' or 'pills'
    	'placement' => 'bellow',
    	'tabs' => array(
        	array('label' => 'Countries', 'content' => $this->renderPartial('_countries', $data_countries,true,true),'active'=>$tabselector['cs']),
        	array('label' => 'States/Provinces', 'content' => $this->renderPartial('_stateprovinces', $data_statesProvinces, true, true),'active'=>$tabselector['stp']),
        	array('label' => 'Universities', 'content' => $this->renderPartial('//university/index', $data_university,true, true),'active'=>$tabselector['uni']),
    	),
	));
Any idea what’s going on here?
 
 
?typo in ‘bellow’ -> should be ‘below’
         
        
           
         
            
       
      
        
        
          
Yii::app()->clientScript->registerScript('key_up_filter',"setupGridView('#".$this->getId()."');");
You are registering a script with the name key_up_filter. But you are registering it multiple times with the same name, I believe Yii will override each other. Try
Yii::app()->clientScript->registerScript('key_up_filter'.$this->getId(),"setupGridView('#".$this->getId()."');");
Also, you can just not register anything and just make a jquery function that ties to all the grid views the key up functionality.