Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Setting theme in onModuleLoad

    Hi,

    Is it supported to set the theme once onModuleLoad() is reached?

    In our application we load the latest user settings in onModuleLoad and would like to set the theme once that info is loaded (but still before any UI components are created).
    The loadSkin of the theme uses Page.loadStyleSheet in ISC_Core.js, which has a branch in the code that is hit when Page.isLoaded() is true and isc.FileLoader is present. That branch uses isc.FileLoader.loadCSSFile(...) but the loadCSSFile is undefined causing an exception (see attachment).

    Test case:
    Code:
    @Override
    public void onModuleLoad()
    {
        loadThemeJs("Graphite");
        //UserAccess.load(() -> onUserPreferencesLoaded());
    }
    
    private native void loadThemeJs(String themeName) /*-{
        var loadScript = $doc.createElement("script");
        loadScript.setAttribute("type", "text/javascript");
        loadScript.setAttribute("src", "sc/skins/" + themeName + "/load_skin.js");
        $doc.body.appendChild(loadScript);
    }-*/;
    Stacktrace:
    ISC_Core.js:4944 Uncaught TypeError: isc.FileLoader.loadCSSFile is not a function
    at _3.isc_c_Page_loadStyleSheet [as loadStyleSheet] (ISC_Core.js:4944:16)
    at isc.loadSkin (load_skin.js:22:14)
    at load_skin.js:2501:5
    Tested using latest v12.1p and version v14.1p_2026-03-25/Pro Deployment (2026-03-25).
    Using the latest version of the Chrome browser.
    Attached Files

    #2
    You can load the skin at any point you want prior to instantiating the first SmartGWT component.

    Loading a skin just means loading load_skin.js and skin_styles.css via whatever mechanism you like (they are ordinary files). The particular API you tried to call depends on the FileLoader module (ISC_FileLoader.js), so, it crashed because you don't have that module loaded.

    Comment

    Working...
    X