Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






jqGrid: Set a fixed background-color for an entire column

No Tags
UserPost

02:25
13/02/2010


carlos.vita

Member

posts 5

Hi,


    How can I set the background-color for an entire column in jqGrid?


    In the colModel array, I've tried to add:

–> color: yellow

–> background-color: yellow"

–> style: 'background-color: yellow'


    None of this has worked.

    I also read the documents about building a custom formatter, but I was unable to make it work. I didn't know how to change the style for a cell element.


    My goal is to have a column that has a different colour, just to help the user to identify that particular important column.

Can someone help me?


Regards,

Carlos

12:14
17/02/2010


tony

Sofia, Bulgaria

Moderator

posts 7383

Hello,

define your own class and add the class in colmodel. Look here how to do this

http://www.trirand.com/jqgridw…..el_options

Regards

Tony

For professional UI suites for PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site – trirand.net – by the very same guys that created jqGrid.

14:09
18/02/2010


carlos.vita

Member

posts 5

Hi Tony,


Thank you for your quick response.


I tried that option and I was unable to change the column class.

I also Googled for examples but I was no luck.


I have something like this in my PHP file:


<STYLE>

        .cvteste {
            background-color: green;
        }

</STYLE>


<SCRIPT type='text/javascript'>

 jQuery('document').ready(function() {

   jQuery('#tbl_table_antiguidadeSaldos').jqGrid({

              ……

              ……

                colModel: [
                    {name:'field_x',         index:'field_x',         align: 'left',  width:  35, classes: 'cvteste'},

               .....

               ....

  });

});

</SCRIPT>


This is not working.

I'm a little rookie on this. Can you please help me?


Regards,

Carlos

12:30
20/02/2010


tony

Sofia, Bulgaria

Moderator

posts 7383

Hello

Try

<STYLE>

        .cvteste {
            background-color: green !important;
        }

</STYLE>

For professional UI suites for PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site - trirand.net - by the very same guys that created jqGrid.

17:18
25/02/2010


carlos.vita

Member

posts 5

Hello Tony,


    Thank you very much. Its working 100% now.

Best regards,

Carlos

No Tags

About the jQuery Grid Plugin - jqGrid forum

Most Users Ever Online:

215


Currently Online:

41 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 10274

Posts: 30361

Membership:

There are 11038 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK - 1210

markw65 - 179

kobruleht - 144

phicarre - 132

YamilBracho - 124

Renso - 118

Administrators: admin (60 Posts)

Moderators: tony (7383 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information