Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Bootstrap Labels In Cgridview?

$
0
0
Hi all,

I was wondering if anyone out there has managed to get Bootstrap labels working on data in a CGridView data table?

What I am trying to do is add a span class to data in one of the columns and then show a certain label style depending on the data in the cell. For example:

<span class="label label-success">Open</span>
<span class="label label-important">Closed</span>
<span class="label label-success">Open</span>
<span class="label label-inverse">Dead</span>
<span class="label label-important">Closed</span>

I have used the following code to add a class to the cell:

            array(
                'name' => 'file_name',
                'header' => 'Filename',
                'filter' => '',
                'cssClassExpression' => '$data["approved"] == 1 ? "bold" : ""',
            ),


This works but only adds a class to the row.

Has anyone got any experience with this?

Many thanks in advance.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>