How to add button in bootstrap.widgets.TbGridView column as a column value

Issue #242 new
mamunur Hosse
created an issue


I am new Yii and not so expert in widget. Please help me to add drop down button in any column using 'value' => {widget to add dropdown}. I am giving the code to make you clear.

$this->widget('bootstrap.widgets.TbGridView', array(
    'rowCssClassExpression' => '\'ticket-followup-\'.$data->ID',
            'name' => 'FOLLOWUP_MESSAGE',
            'value'=>   '"<div class=\"summery\">". split_words(CHtml::decode($data->FOLLOWUP_MESSAGE), 10). "</div>"
                            ."<div class=\"details hide\">".  CHtml::decode($data->FOLLOWUP_MESSAGE) . "</div>" 

            'type' => 'html',
            'htmlOptions'=>array('width'=>'90%', "id" => $model->ID, 'class'=>'followup-row content-area',),


            'name'          =>  'ENTRY_TIME', 
            'value' => 'btnWidget()',

            'type'          =>  'html',
            'header'        =>  false,
            'filter'        =>  false,
            'htmlOptions'   =>  array('width'=>'10%', "id" => '$row+1', 'class'=>'followup-row ',),



function btnWidget(){

    $widget = new CWidget();
    return $widget->widget('bootstrap.widgets.TbButtonGroup', array(
        'type'=>'info', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
            array('label'=>'Action', 'url'=>'#'),
                array('label'=>'Action', 'url'=>'#'),
                array('label'=>'Another action', 'url'=>'#'),
                array('label'=>'Something else', 'url'=>'#'),
                array('label'=>'Separate link', 'url'=>'#'),
    ), true) ;


By this code a grid view is populated with a button but the button is not the dropdown able. After analyzing I found that the code is missing the data-toggle="dropdown". I test that inspecting code using chrome and applying the code.

Please help me. I am stacked by this point.

Comments (0)

  1. Log in to comment