Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to dynamically change bootstrap themes with GWTBootstrap3. I'm not sure where to start looking, so I haven't tried anything at all. I found an outdated article for the older gwt-boostrap. But all I've found for bootstrap3 is this[^] which only shows how to attach a theme. I need to be able to switch it based on variables in the code.
Posted

1 solution

I changed my bootstrap include to notheme:

HTML
<inherits name="org.gwtbootstrap3.GwtBootstrap3NoTheme" />


and then I used a function to load the css that I wanted:

Java
public static native void loadCss(String url)/*-{
        var fileref=document.createElement("link");
        fileref.setAttribute("rel","stylesheet");
        fileref.setAttribute("type","text/css");
        fileref.setAttribute("href", url);
        $doc.getElementsByTagName("head")[0].appendChild(fileref);
    }-*/;


If you want to use the stock theme, you'll have to load it manually as well using this method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900