Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to restore default value after setting a css property
How to restore default value after setting a css property [message #1796128] Fri, 05 October 2018 14:17 Go to next message
Pauline Deville is currently offline Pauline DevilleFriend
Messages: 36
Registered: November 2016
Location: Paris Saclay, France
Member
Hello,

I need to set and unset CSS property.

To set a property I use the NatTableCSSHandler and it works fine. However, I also need to unset the property, I would like to restore the default theme for one or many property even for all properties if possible.

My first idea was to use the NatTableCSSHandler.applyCSSProperty with a null value but it doesn't works for me since I get back an exception. I try to change the theme (using nattable.setTheme()) but apparently the css override the theme. I don't know how to do that.

Do you have any idea that can help me to do this ?

Best regards,
Pauline
Re: How to restore default value after setting a css property [message #1796130 is a reply to message #1796128] Fri, 05 October 2018 15:02 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2724
Registered: July 2012
Senior Member
Not sure. Either remember the previous value or re-apply the previous CSS file.
Re: How to restore default value after setting a css property [message #1796201 is a reply to message #1796130] Mon, 08 October 2018 08:56 Go to previous messageGo to next message
Pauline Deville is currently offline Pauline DevilleFriend
Messages: 36
Registered: November 2016
Location: Paris Saclay, France
Member
Hi Dirk,

First of all thank you for your really quick answer. I thought about re-apply a default CSS but I didn't know how to restore the alternate colour row by using CSS. I just find that I could do that by using the transparency and set it to zero.
This solution should work to restore the default style, thank you.

Best regards,
Pauline
Re: How to restore default value after setting a css property [message #1796737 is a reply to message #1796201] Thu, 18 October 2018 09:45 Go to previous messageGo to next message
Pauline Deville is currently offline Pauline DevilleFriend
Messages: 36
Registered: November 2016
Location: Paris Saclay, France
Member
Hello,

After all, this solution doesn't work for us since we don't have a previous CSS style. Our default theme is the default Nattable configuration provided by the layers configuration and stored in the ConfigRegistry. We would like to remove every CSS properties set.

We find a "solution" (which is not acceptable), it is to create a new ConfigRegistry and set it in the nattable configRegistry. However, to force the configuration we have to set the AbstractLayer::configurationApplied feild to false at the end of the AbstractLayer::configure method.

Do you know if there is an better solution to do that ?

Best regards,
Pauline
Re: How to restore default value after setting a css property [message #1796747 is a reply to message #1796737] Thu, 18 October 2018 11:46 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2724
Registered: July 2012
Senior Member
It sounds like you are mixing the default configuration based styling approach with the CSS styling approach. But actually the ConfigRegistry contains only the current value. Simply restoring the previous values is not possible that easy.

You might want to look at the theme styling in NatTable. In the ThemeConfigurations I integrated all styles from the specific style configurations, and I added the support to switch between themes. If you look into the code you will see that on switching a theme the styles of the current theme are actively unregistered and then the styles from the new theme are registered.

Maybe that helps you in implementing your use cases.
Re: How to restore default value after setting a css property [message #1796841 is a reply to message #1796747] Fri, 19 October 2018 16:21 Go to previous message
Pauline Deville is currently offline Pauline DevilleFriend
Messages: 36
Registered: November 2016
Location: Paris Saclay, France
Member
Hello,

Thanks for your quick answer. We will look at it.

Best regards,
Pauline
Previous Topic:Resizing Columns for a Single Row
Next Topic:How to read Map in Nattable
Goto Forum:
  


Current Time: Wed Oct 16 16:58:33 GMT 2019

Powered by FUDForum. Page generated in 0.01935 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top