Search bar not showing in table

Hello,

Quick question please.

I have this:




	/**

	 * @return array validation rules for model attributes.

	 */

	public function rules()

	{

		// NOTE: you should only define rules for those attributes that

		// will receive user inputs.

		return array(

			array('main_cat_id, subcategory', 'required'),

			array('main_cat_id', 'numerical', 'integerOnly'=>true),

			array('subcategory', 'unique'),

			array('subcategory', 'length', 'max'=>150),

			// The following rule is used by search().

			// @todo Please remove those attributes that should not be searched.

			array('id, main_cat_id, subcategory', 'safe', 'on'=>'search'),

		);

	}



in relations:




	public function relations()

	{

		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array(

            'usercatRel' => array(self::HAS_MANY, 'BusiDirectory', 'category_id'),

            'userActiveDirRel' => array(self::HAS_MANY, 'BusiDirectory', 'category_id', 'condition'=>'is_active="yes"'),

            'mainCatRel' => array(self::BELONGS_TO, 'DirMainCat', 'main_cat_id'),

		);

	}



Then in the view




<?php $this->widget('bootstrap.widgets.TbGridView',array(

	'id'=>'dir-sub-cat-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

		'id',

		'mainCatRel.category',

		'subcategory',

		array(

			'class'=>'bootstrap.widgets.TbButtonColumn',

		),

	),

)); ?>



I just cannot get the "Category" column to have an ajax search bar like the id and sub category column, any idea why please?

Thank you.

Take a look at the following wiki.

http://www.yiiframework.com/wiki/281/searching-and-sorting-by-related-model-in-cgridview

This is a MUST READ.