Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set style as important from within GWT code?

I've the following style that I need to set at run-time from within GWT code:

margin: 0 0 0 -6px !important;

I've tried the following which didn't work:

Style style = htmlProductSearch.getElement().getStyle();
style.setProperty("margin", "0 0 0 -6px !important");

However, when I removed the !important from the string, it works.. but I urgently need to make this style important.

Also I've used the setters methods setMarginxxxx but didn't work too.

Thanks.

like image 652
Muhammad Hewedy Avatar asked Oct 12 '22 08:10

Muhammad Hewedy


2 Answers

htmlProductSearch.getElement().setAttribute("style","margin : 0 0 0 -6px !important");
Hope this should work.

like image 79
Meuk Light Avatar answered Oct 29 '22 04:10

Meuk Light


Not a perfect solution but you can use the addStyleName to add a css style.

In this css style you can use the !important.

This will work I think

like image 20
Ronan Quillevere Avatar answered Oct 29 '22 05:10

Ronan Quillevere