Programatic control over css for alternating lines

Questions and answers for designing and implementing forms in Servoy

Programatic control over css for alternating lines

Postby bevil » Mon Mar 09, 2015 9:20 pm

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
bevil
 
Posts: 163
Joined: Thu Oct 18, 2012 7:31 pm

Re: Programatic control over css for alternating lines

Postby bevil » Tue Mar 10, 2015 9:24 am

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?
bevil
 
Posts: 163
Joined: Thu Oct 18, 2012 7:31 pm

Re: Programatic control over css for alternating lines

Postby david » Tue Mar 10, 2015 4:09 pm

No :)
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Programatic control over css for alternating lines

Postby bevil » Tue Mar 10, 2015 4:17 pm

Goodness.. That is pretty emphatic.... What a pity.. :(
bevil
 
Posts: 163
Joined: Thu Oct 18, 2012 7:31 pm

Re: Programatic control over css for alternating lines

Postby david » Tue Mar 10, 2015 4:31 pm

Some tools you can look forward to using:

http://sass-lang.com/
http://lesscss.org/
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Programatic control over css for alternating lines

Postby sbutler » Tue Mar 10, 2015 4:34 pm

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.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH


Return to Forms

Who is online

Users browsing this forum: No registered users and 9 guests