I have custom widget... I just want to call the widget in Tbgridview...
Here is code..
$this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'test1',
'type' => 'striped bordered condensed',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'name',
'addr',
'email',
array(
'type' => 'raw',
'value' => $this->widget('DropDownRedirect', array(
'data' => array('1'=>'1','2'=>'2','3'=>'3'))),
),
)
));
its not working.. can anybody help me?...
please refer the class DropdownRedirect given below.
class DropDownRedirect extends CWidget {
public $name;
public $select;
public $data;
public $htmlOptions = array();
public $url;
public $replacement = '__value__';
protected function registerScript() {
$script = '$("#'.$this->id.'").change(function(){'
.'$(location).attr("href", "'.$this->url.'".replace("'.$this->replacement.'", $(this).val()));'
.'});';
Yii::app()->clientScript->registerScript(__CLASS__.$this->id, $script);
}
public function init() {
if (! isset($this->name))
$this->name= $this->id;
$this->registerScript();
}
public function run() {
if (!isset($this->htmlOptions['id'])) $this->htmlOptions['id'] = $this->id;
echo CHtml::dropDownList($this->name, $this->select, $this->data, $this->htmlOptions);
}}
Thanks in advance