0

I want to know why building 2 sets of applications with different themes failed. I followed the official tutorial : https://docs.sencha.com/cmd/7.8.0/guides/microloader.html#microloader_-_dynamic_manifest

theme-Custom has been generated in my package/local

Whether my route is http://localhost:8080/logon?theme=Logon or http://localhost:8080/logon?theme=Logon-A, the resulting theme is ext-theme-neptune, no theme switching

So what exactly caused the failure of switching themes?

{
    /**
     * The toolkit to use. Select either "classic" or "modern".
     */
    "toolkit": "classic",

    /**
     * The application's namespace.
     */
    "name": "Logon",

    /**
     * Comma-separated string with the paths of directories or files to search. Any classes
     * declared in these locations will be available in your class "requires" or in calls
     * to "Ext.require". The "app.dir" variable below is expanded to the path where the
     * application resides (the same folder in which this file is located).
     */
    "classpath": "${app.dir}/app",

    /**
     * The Sencha Framework for this application: "ext" or "touch".
     */
    "framework": "ext",

    /**
     * The name of the theme for this application.
     */
    "theme": "ext-theme-neptune",
    "builds": {
        "Logon": {
                    "theme": "ext-theme-neptune"
                },
    "Logon-A": {
                    "theme": "theme-Custom"
                }
    },
"bootstrap": {
    "manifest": "${build.id}.json"
    }
    }

<!DOCTYPE HTML>
<html manifest="">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=yes">
    <title>Logon</title>
    <script type="text/javascript">
        window.GLOBAL_CONTEXTROOT = '<%= com.SystemConfig.getContextRoot() %>';
    </script>
    <script type="text/javascript">
    var Ext = Ext || {};
    Ext.beforeLoad = function (tags) {
        var theme = location.href.match(/theme=([\w-]+)/);

        theme  = (theme && theme[1]) || 'Logon';

        Ext.manifest = theme ;
        console.log(Ext.manifest);
    };
</script>


    <!-- The line below must be kept intact for Sencha Cmd to build your application -->
    <script id="microloader" type="text/javascript" src="bootstrap.js"></script>

</head>
<body></body>
</html>

1 Answer 1

0
  1. The help is based on ExtJS 5. There is no on-the-fly-theme-switching
  2. ExtJS 5 Kitchensink and 7 modern Kitchensink handle this different. In 7 they override the :root vars. That is on the fly.
  3. After Building you have to have different json files available at the root. And it's still not on-the-fly

What is possible using that technique is to decide before loading, which theme to use. And that is working.

What is not possible is to swap themes on the fly.

Just to get you more details.

CLASSIC: no hotswap
MODERN : easy, just add `root:` stuff
Sign up to request clarification or add additional context in comments.

2 Comments

Hi Dinkheller, In Ext JS version 6.5.1, I found that the Classic Toolkit's Kitchensink can also perform theme switching. examples.sencha.com/extjs/6.5.1/examples/kitchensink/#all
Right, but it is still doing a full reload of the iframe (examples-iframe). That's what I was talking about. It's not a hot-swap, but a full reload.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.