-
2 Jan 2012 1:52 AM #1
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 Jan 2012 6:30 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
- Answers
- 3160
Ext JS 3 or 4?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Jan 2012 8:33 PM #3
-
3 Jan 2012 5:23 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
- Answers
- 3160
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Jan 2012 8:54 PM #5
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.'); } });


Reply With Quote