1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    25
    Vote Rating
    0
    Answers
    1
    sanjayarrk1 is on a distinguished road

      0  

    Default Unanswered: Can we implement the user based theme in extJS?

    Unanswered: Can we implement the user based theme in extJS?


    Hi,

    I have a requirement where I have to load the theme based on the user data available in data base.

    How i can do that? Is extJS supporting the user based theme selection?

    Any help will be highly appreciated.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,547
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Ext JS 3 or 4?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    25
    Vote Rating
    0
    Answers
    1
    sanjayarrk1 is on a distinguished road

      0  

    Default


    Its ExtJS 4

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,547
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I will move this to the appropriate forum.

    Have you seen the theme example? It replaces the theme with another.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    25
    Vote Rating
    0
    Answers
    1
    sanjayarrk1 is on a distinguished road

      0  

    Default


    Hi, I have implemented it in a different way. This way i can achieve that.

    Code:
    ScriptLoaderMgr = function() {
        this.loadCss = function(scripts) {
            var id = '';
            var file;
    
    
            if (!Ext.isArray(scripts)) {
                scripts = [scripts];
            }
            for (var i = 0; i < scripts.length; i++) {
                file = scripts[i];
                id = '' + Math.floor(Math.random() * 100);
                Ext.util.CSS.createStyleSheet('', id);
                Ext.util.CSS.swapStyleSheet(id, file);
            }
        };
    };
    
    
    LoadMgr = new ScriptLoaderMgr();
    
    
    /* To get the User details from data base server & changing the theme based on user data*/
            Server.getUserDetails(function(res) {
                if (res != null) {
                    DSHB.userDetails = res;
                    /*Added to load the theme based on user data*/
                    if (DSHB.userDetails.theme == CONSTANTS.get('THEME_GRAY')) {
                        LoadMgr.loadCss(['resources/css/my-ext-theme.css', 'itemSelector.css', 'dashboard.css', 'TabScrollerMenu.css']);
                    } else if (DSHB.userDetails.theme == CONSTANTS.get('THEME_BLACK')) {
                        LoadMgr.loadCss(['resources/css/accessibility-theme.css', 'itemSelector.css', 'dashboard.css', 'TabScrollerMenu.css']);
                    }
                } else {
                    Ext.Msg.alert('Error', 'No User Details are configured.');
                }
            });

Thread Participants: 1