Question

I am using Yii with bootstrap features;

So, I have changed the container tagName from div to table;

Now, the table with the items class is inside the table with table class;

The template property defines my issue;

How do I add the following class : table table-striped table-hover to the table with items class?

the tables structure is:

<table class="table">
<tr>
<td>
<table class="items">
...

{items} generates the <table class="items"> table

<?php
            $this->widget('zii.widgets.grid.CGridView', array(
                'id' => 'orders-grid',
                'dataProvider' => $model->search(),
                'filter' => $model,
                'ajaxUrl' => Yii::app()->baseUrl . '/orders/admin',
                'tagName' => 'table',
                'htmlOptions' => array(
                    'class' => 'table',
                    'style' => 'width:auto;',
                    'align' => 'left',
                ),
                'cssFile' => Yii::app()->baseUrl . '/css/custom.css',
                'template' =>
                '<tr><td style="border-top:none;height:74px;">{pager}</td></tr>' .
                '<tr><td style="height:34px;border-top:none;">{summary}</td></tr>' .
                '<tr><td>{items}</td></tr>' .
                '<tr><td style="border-top:none;">{summary}</td></tr>' .
                '<tr><td style="border-top:none;height:74px;">{pager}</td></tr>',
                'columns' => array(
                    array(
                        'header' => 'Order ID',
                        'name' => 'id',
                        'type' => 'raw',
                        'value' => 'CHtml::link(str_pad($data->id, 9, "0", STR_PAD_LEFT),array("update","id"=>$data->id))',
                    ),
                    array(
                        'header' => 'Name',
                        'name' => 'var_user_full_name',
                        'value' => '$data->UserFullName',
                        'filter' => CHtml::activeTextField($model, 'var_user_full_name'),
                    ),
                    array(
                        'name' => 'total_price',
                        'type' => 'raw',
                        'value' => 'CurrencyData::$_currency[$data->currency]." ".$data->total_price',
                    ),
                    array(
                        'name' => 'created',
                        'value' => 'date("d/m/Y",$data->created)',
                        'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                            'model' => $model,
                            'attribute' => 'created',
                            'language' => 'en-AU',
//                            'i18nScriptFile' => 'jquery.ui.datepicker-en.js',
                            'htmlOptions' => array(
                                'id' => 'datepicker_for_due_date',
                                'size' => '10',
                            ),
                            'defaultOptions' => array(
                                'showOn' => 'focus',
                                'dateFormat' => 'dd/mm/yy',
                                'showOtherMonths' => true,
                                'selectOtherMonths' => true,
                                'changeMonth' => true,
                                'changeYear' => true,
                                'showButtonPanel' => true,
                            )
                                ), true),
                    ),
                    array(
                        'name' => 'active',
                        'header' => 'Status',
                        'value' => 'OrdersData::$active[$data->active]',
                        //'filter' => OrdersData::$active,
                        'filter' => CHtml::activeDropDownList($model, 'active', OrdersData::$active, array('prompt' => '-Select-')),
                    ),
                    array(
                        'class' => 'CButtonColumn',
                        'header' => 'Action',
                        'template' => '{update}',
                    ),
                ),
            ));
            ?>
Was it helpful?

Solution

found it:

'itemsCssClass' => 'table table-striped table-hover',
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top