Question

Given the code below, I need to customize the third column to show two links instead of that BsButtonColumn. I didn't find any related documentation to get the answer.

<?php
    $this->widget(
        'bootstrap.widgets.BsGridView',
        array(
            'id' => 'activity-translation-grid',
            'dataProvider' => $model->search(),
            'filter' => $model,
            'columns' => array(
                'id',
                'name',
                array(
                    'class' => 'BsButtonColumn',
                ),
            ),
        )
    );
?>
Was it helpful?

Solution

Maybe something like:

$this->widget(
    'bootstrap.widgets.BsGridView',
    array(
        'id' => 'activity-translation-grid',
        'dataProvider' => $model->search(),
        'filter' => $model,
        'columns' => array(
            'id',
            'name',
            array(
                'class' => 'bootstrap.widgets.BsButtonColumn',
                'template' => '{en} {es} {it}',
                'buttons' => array(
                    'en' => array(
                        'label' => 'EN',
                        'url' => '"translate/en/" . $data->id',
                        'visible' => '1',
                    ),
                    'es' => array(
                        'label' => 'ES',
                        'url' => '"translate/en/" . $data->id',
                        'visible' => '1',
                    ),
                    'it' => array(
                        'label' => 'IT',
                        'url' => '"translate/it/" . $data->id',
                        'visible' => '1',
                    ),
                ),
            ),
        ),
    )
);

OTHER TIPS

$this->widget(
    'bootstrap.widgets.BsGridView',
    array(
        'id' => 'activity-translation-grid',
        'dataProvider' => $model->search(),
        'filter' => $model,
        'columns' => array(
            'id',
            'name',
            array(
                'class' => 'CLinkColumn',
                'urlExpression' => '"translate/en/" . $data->id',
            ),
            array(
                'class' => 'CLinkColumn',
                'urlExpression' => '"translate/es/" . $data->id',
            ),
            array(
                'class' => 'CLinkColumn',
                'urlExpression' => '"translate/it/" . $data->id',
            ),
        ),
    )
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top