Use this board to ask questions or have discussions with other Rich Displays users.
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:
Post
by Paul_Ramcharitar » Fri Jul 07, 2017 9:08 am
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
Post
by Scott Klement » Fri Jul 07, 2017 10:12 am
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:
Post
by Paul_Ramcharitar » Fri Jul 07, 2017 10:43 am
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
Post
by Scott Klement » Tue Jul 11, 2017 11:55 am
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:
Post
by Paul_Ramcharitar » Thu Jul 13, 2017 9:08 am
I got it to work now.
I indeed did not call the render() method to re-render the grid.
Thanks Scott
Users browsing this forum: No registered users and 3 guests