CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Changing CSS Property at runtime

by mrcarver » 01 Dec 2017 21:19

CG Gurus,

I am seeing a problem with the dynamic changing of CSS controls. Please review below, and recommend how to resolve the dynamic assignment of CSS. What is of particular interest is how to control inner and outer class of divs. Note, pressing F5 fixes the problem.

Scenario:

I have a CGWizard with about 15 tabs, which with all tabs contains about a 100 controls. In the on render event each of these controls are set with their respective CSS styles as read from the DB. In the OnChanging event of the CGWizard, the data for the respective control is loaded from the DB.

So, far so good. Note that styles added in the OnRender (or with an AjaxReRender) appear in the outer div. So see for example the "req" css style in the attachment.
StyleInOuterDiv.PNG


So now for the problem, when changing the CSS after render, the style is managed asynchronously,which is appreciated. However the style gets inserted into the inner div. See for example in the following attachment, we see the "req" css was assigned in onRender,. But because this CG object is required, and the text was blank, the "cc-error" style was added, and because it did not not find the "req" flag it was added as well. Which should not have, because it existed in the Outer div, but the when compared against memoAppID_01.css the 'req" was not found. Apparently it internally checks against the inner div.
StyleInOuterAndInnerDiv.PNG


This results in the following image:
DuplicateCss.PNG


Note, the control in this example is the TIWCGJQMemoEx, a similar problem exists with the TICCGJWDropDown.

DropDown OnRender:
DupCSSOnRenderDropDown.PNG


After Async changing of css:
DupCSSOnAsyncDropDown.PNG
You do not have the required permissions to view the files attached to this post.
mrcarver
 
Posts: 70
Joined: 05 Jun 2012 10:51

by Alexander Bulei » 04 Dec 2017 18:22

Hi mrcarver,

So now for the problem, when changing the CSS after render, the style is managed asynchronously,which is appreciated. However the style gets inserted into the inner div. See for example in the following attachment, we see the "req" css was assigned in onRender,. But because this CG object is required, and the text was blank, the "cc-error" style was added, and because it did not not find the "req" flag it was added as well. Which should not have, because it existed in the Outer div, but the when compared against memoAppID_01.css the 'req" was not found. Apparently it internally checks against the inner div.


Please explain better this part...who is assigning the req & cc-error classes?
The Css property of MemoEx will add to the inner control, in this case, the textarea.
You need to add the class to the container(div)?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by GerritS » 25 Feb 2020 11:45

Hi Alexander,

I'm experiencing the same problem. I have a very simple input form with a IWCGJQMemoEx and two IWCGJQDropDown on it. They get a CSS, like for instance 'memofield'.

When I check the contents before allowing the user to close the form I add a 'fielderror' to the CSS if the field is incorrect, thus getting a CSS of 'memofield fielderror'. The fielderror part just adds a background-color. After assigning this new CSS in runtime, the memo is jumping off the form, because the inner part (the textarea) gets suddenly the same CSS as the Memo itself. So when the memo itself was positioned (absolute) at 100,100, the textarea is, after giving it a CSS at runtime (even if it's the same CSS), positioned op 100,100 from the memo and will be at 200.200.

If you wish, I have a simple example where I have a TIWMemo which jumps as expected and a TIWCGJQMemoEx which jumps (in two parts !) as described.

After posting I noticed the original message is from 2017 ?

Best regards,
Gerrit
GerritS
 
Posts: 19
Joined: 29 May 2017 20:16

by Alexander Bulei » 03 Mar 2020 15:25

Hi GerritS,
What is your IW version?
Please visit the download section and check the recommended IW version for 15.1.x, due the ajax render issues with < 15.1.12

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by GerritS » 04 Mar 2020 11:14

Hi Alexander,

After updating to 15.1.15 (both Intraweb and CGDevtools), recompiling and copying the new wwwroot, I still have the same problems. I will send you a simple example project.It shows the differences between a IWMemo and a IWCGJQMemoEx component.

Best regards,
Gerrit
You do not have the required permissions to view the files attached to this post.
GerritS
 
Posts: 19
Joined: 29 May 2017 20:16


Return to JQMemoEx

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.