Page 1 of 1

Programatic control over css for alternating lines

PostPosted: Mon Mar 09, 2015 9:20 pm
by bevil
I have a few solutions which use onRender to change colour of lines, but I have found that there is a performance penalty with that, and I am trying to use css to achieve the same thing.

Some of my current solutions are SAAS, and have a 'superuser' form on which I identify the various colours for each tenant. I then set some globals from that, and use the link to the superuser form per tenant to show different colours per group of users. It works very well.

In moving to CSS, I now don't seem to be able to rewrite my stylesheet on the fly. I don't want to have to have a different stylesheet per tenant, but rather have one stylesheet whose data is written by an interrogation of the superuser form.

Perhaps I am missing something obvious, or perhaps ti s not possible.

Any help would be appreciated..

Bevil

Re: Programatic control over css for alternating lines

PostPosted: Tue Mar 10, 2015 9:24 am
by bevil
In other words, I want to change parameters on my stylesheet by changing the values of some fields on a form. Any chance of this?

Anyone?

Re: Programatic control over css for alternating lines

PostPosted: Tue Mar 10, 2015 4:09 pm
by david
No :)

Re: Programatic control over css for alternating lines

PostPosted: Tue Mar 10, 2015 4:17 pm
by bevil
Goodness.. That is pretty emphatic.... What a pity.. :(

Re: Programatic control over css for alternating lines

PostPosted: Tue Mar 10, 2015 4:31 pm
by david
Some tools you can look forward to using:

http://sass-lang.com/
http://lesscss.org/

Re: Programatic control over css for alternating lines

PostPosted: Tue Mar 10, 2015 4:34 pm
by sbutler
I haven't tried this before, but it should be possible. Just use the solution model and change the style. You have to do this in onSolutionOpen, as once a form is loaded, the style is locked in.

Code: Select all
var style = solutionModel.getStyle('my_existing_style')
//Change the Style
style.content = 'combobox { color: #0000ff;font: italic 10pt "Verdana";}'


And if you need more advanced, you can always use the Solution Model to edit your form, and change the Style name of that form. You can also create new Styles on the fly, then assign them to forms. So, it *should* be possible, but will take some work.