Yii Framework Forum: TbExtendedGridView - row colors - Yii Framework Forum

Jump to content

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

TbExtendedGridView - row colors I want to change the background color based on a data value. Rate Topic: -----

#1 User is offline   RandyCoots 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 25-October 17

Posted 07 November 2017 - 03:49 PM

Hi,

I have an application calling the TbExtendedGridView widget.

I added 'rowCssClassExpression' => 'ticketassignments->color($this->ticket_id)',

Then created

public function color($myid) {
$color = 'green'; // testing
return $color;

This is supposed to pass the 'green' value to the css script.
The problem I'm having is determining which css file to use.

in the .\public\assets\9e142ad5\gridview\styles.css I've added

tr.green
{
background: #CEF6D8;
}
.grid-view table.items tr.green
{
background: #CEF6D8;
}

this has had no affect.

I've attempted modifying the override.css, and main.css in the public/css folder as well, to no affect.

I have searched thru my controllers, looking for a statement registering any css files, but have been unable to locate them so far.

Any help would be highly appreciated.

Thanks,
Randy
0

#2 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,824
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 07 November 2017 - 04:19 PM

This may help
http://www.yiiframew...isterCss-detail

http://www.yiiframew...cripts-and-css/
Wiki article a bit off topic

Better link (to the CSS part)
http://www.yiiframew...ts-and-css/#hh1

Google: site:yiiframework.com 1.1 CClientscript

You will find old threads like this:
http://www.yiiframew...-real-position/
Don't forget to read The Definitive Guide to Yii (1.1 en) (1.1 sv) (2.0 en) | The class reference (1.1) (2.0) has the details
0

#3 User is offline   RandyCoots 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 25-October 17

Posted 07 November 2017 - 04:40 PM

Thanks Tri,

I did a search and found 164 css files.

Randy

Register your own CSS and have it placed after any existent CSS it should extend/override.
0

#4 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,824
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 08 November 2017 - 08:28 AM

View PostRandyCoots, on 07 November 2017 - 04:40 PM, said:

Thanks Tri,

I did a search and found 164 css files.

Randy

Register your own CSS and have it placed after any existent CSS it should extend/override.


By mistake I added my reply at the end of your post. Sorry for that.

I added links to examples how to register CSS.
Looking at your code, I recommend you first try with a unused class name (not "green"), and enter it directly as "rowCssClassExpression" until you have sorted things out (e.g which element should have CSS added).

(Last time, 5 years ago, I used Firebug to examine elements and their chain of CSS in effect, including file names.)
Don't forget to read The Definitive Guide to Yii (1.1 en) (1.1 sv) (2.0 en) | The class reference (1.1) (2.0) has the details
0

#5 User is offline   RandyCoots 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 25-October 17

Posted 08 November 2017 - 11:41 AM

Thank you Tri, I'll give it a try.

I do appreciate your help, as I'm not finding documentation on this feature I'm trying to implement.
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