Forum

November 2nd, 2014
A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
jqGrid: Set a fixed background-color for an entire column
13/02/2010
02:25
carlos.vita
Member
Forum Posts: 5
Member Since:
13/02/2010
Offline

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

17/02/2010
12:14
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7720
Member Since:
30/10/2007
Offline

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.
18/02/2010
14:09
carlos.vita
Member
Forum Posts: 5
Member Since:
13/02/2010
Offline

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

20/02/2010
12:30
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7720
Member Since:
30/10/2007
Offline

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.
25/02/2010
17:18
carlos.vita
Member
Forum Posts: 5
Member Since:
13/02/2010
Offline

Hello Tony,

    Thank you very much. Its working 100% now.

Best regards,

Carlos

Forum Timezone: Europe/Sofia

Most Users Ever Online: 215

Currently Online:
78 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1245

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11349

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10556

Posts: 31227

Newest Members: geneleung, benhamc, vi6cmevm, htec1, atalabaseen, rboatright

Moderators: tony: 7720, Rumen[Trirand]: 81

Administrators: admin: 61

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information