Page 1 of 1

Change Header Background

Posted: Fri Jul 07, 2017 9:08 am
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.

Re: Change Header Background

Posted: Fri Jul 07, 2017 10:12 am
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"

'
'

Re: Change Header Background

Posted: Fri Jul 07, 2017 10:43 am
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.

Re: Change Header Background

Posted: Tue Jul 11, 2017 11:55 am
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.

Re: Change Header Background

Posted: Thu Jul 13, 2017 9:08 am
by Paul_Ramcharitar
I got it to work now.

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

Thanks Scott