Yii Framework Forum: GridView::widget Style Column using condition. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

GridView::widget Style Column using condition.

#1 User is offline   voelkl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 04-February 17

Posted 13 May 2017 - 12:19 AM

Hi There,

I have a status column in our Yii App, the data pulled from the database is an integer.
We have a Settings model that we use to pull the string label that matches our status.

We are looking to style this column, so apply some bootstrap CSS so that the different status display as different colours using the bootstrap label class.

My question is how do you set the style of a GridView::widget using a condition.

The attribute we wish to style is;

        ['attribute'=>'jStatus',
           
			 'format'=>'raw',
			 'value'=>function($data){
			   return \common\models\Settings::findOne(['sKey'=>'job_status','sValue'=>$data->jStatus])->sLabel;
			 }],


Thank you =)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users