Add/remove classes on responsive form elements

Forum to discuss the new web client version of Servoy.

Add/remove classes on responsive form elements

Postby steve1376656734 » Mon Jan 08, 2018 3:25 pm

Hi,

I have a responsive form to which I have added a container with 1 row and 1 column. The row has been given a name and I now want to change the class on this row in my .js file.

With normal elements I just use:

Code: Select all
elements.elementname.addStyleClass("newClassName")


Unfortunately, the name of the row does not show up in autocomplete when I type elements so how would I add or remove a class on the row programmatically?

Thanks
Steve
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 199
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: Add/remove classes on responsive form elements

Postby paronne » Mon Jan 08, 2018 3:55 pm

Hi,

containers such as row and columns are stateless, is not possible to change their class at runtime.
If you really need to change the style of a layout container at runtime, rather than adding the class to the container, you may add the class to the form itself using plugins.ngclientutils.addFormStyleClass(formname,styleclass);
In CSS you can then target the container contained by the form

Code: Select all
.runtimeclass-added-toform   .row.your-row-name { ... }


This code will target any row having class ".your-row-name" contained by the form .
You should make sure yourself to use an unique class name to the row you want to style, in this way you avoid conflicts with other use cases.

Regards,
Paolo
paronne
 
Posts: 107
Joined: Fri Nov 02, 2012 3:21 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 1 guest