0

I am trying to change the styling of the gridview, tableview, & detailview. I found something saying that I should change the config/main.php file to this:

...
// application components
'components'=>array(
    'user'=>array(
        // enable cookie-based authentication
        'allowAutoLogin'=>true,
    ),
    'bootstrap'=>array(
        'class'=>'bootstrap.components.Bootstrap',
    ),
     'widgetFactory'=>array(
        'widgets'=>array(
            'CGridView'=>array(
                'cssFile' => Yii::app()->request->baseUrl.'/css/table_and_grid.css',
            ),

        ),
    ),
...

I have removed the assets folder that is generated by the app, but that didn't help. When I load the view, I can see that the css sheet is being loaded into the header of the page, but none of the styling is working. Why? How do I fix?

3
  • What position does your custom css file load? Can you use Web inspector to check the browser's interpretation of your css rules? Commented Feb 18, 2014 at 17:17
  • @ragingprodigy It's one of the first to load. And the browser isn't interpreting ANY of the rules, which is the problem. Commented Feb 18, 2014 at 17:20
  • i dont think that you need to change main.config for changing style. If you need to change style you can override the functions and properties in base class. Commented Feb 18, 2014 at 17:49

1 Answer 1

1

I haven't seen anything about changing the style of CGridView in main config file(main.php), But you can customize CGridView styles with bellow parameters:

$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'SOME ID',
'dataProvider'=>$YOUR_DATA_PROVIDET,
'cssFile'=>'...',
'baseScriptUrl'=>'...',
'filterCssClass'=>'...',
'itemsCssClass'=>'...',
'pagerCssClass'=>'...',
'rowCssClass'=>'...',
'summaryCssClass'=>'...',
));

You can change ... with your own. for more information you can check CGridView's Official document on the following link:

CGridView

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.