Change Header Background

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Change Header Background

Post by Paul_Ramcharitar »

I am unable to change the header background of a subfile grid using javascript.

I tried using setProperty( property, value ) http://www.profoundlogic.com/docs/pages ... Id=4849915. For e.g.

Code: Select all

getObj("Grid1").grid.setProperty("header background", "#FF0000");
I tried it in the onclick of a button. However the background did not change.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Change Header Background

Post by Scott Klement »

It will only work on a grid that does not use images for the background. Images take precedence over colors.

For example, try it with a "simple grid"

'
'
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Change Header Background

Post by Paul_Ramcharitar »

Hi Scott,

I tried it with a simple grid but the "header background" still did not change.

However, it works on the "column headings" property.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Change Header Background

Post by Scott Klement »

This seems to work for me...

Code: Select all

var myGrid = getObj("Grid1");
myGrid.grid.setProperty("header background", "#ff0000");
myGrid.grid.render();
If you were, indeed, using a simple grid (or any other grid that doesn't use an image in its css for the header background) then the above code should work. If this isn't working for you, I can only assume that you were doing it after the grid had already rendered, and forgot to call the render() method to make it re-render.
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: Change Header Background

Post by Paul_Ramcharitar »

I got it to work now.

I indeed did not call the render() method to re-render the grid.

Thanks Scott
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests