Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9255279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:40:54+00:00 2026-06-18T11:40:54+00:00

I’m using Ext JS 4.1 to create a CRM-type application. To connect to the

  • 0

I’m using Ext JS 4.1 to create a CRM-type application. To connect to the server side, I’m using Ext Direct via the RemotingProvider.

Before the application launches and renders, I want to retrieve some global variables from the server via Ext Direct, mainly the configured language of the currently logged in user and their configured permissions. Then, depending on the language of the user (from that result), I need to load both the Ext JS locale file and my own custom locale file. (Note that those must be loaded before any component is created, because they won’t be applied afterwards.)

So, the procedure is:

  1. get Globals via Ext.php.Globals.getGlobals
  2. get Ext locale via Ext.loader.loadScript,
  3. get App locale via Ext.loader.loadScript
  4. setup viewport

Since 1.-3. are asynchronous, I saw no other way than to nest the callbacks:

Ext.application({
  name: 'MyApp',

  launch: function() {
    var app = this;

    // Welcome to callback hell...
    Ext.php.Globals.getGlobals(function(data) {
      // insert globals into app namespace
      Ext.apply(MyApp, data);

      // load ext locale
      Ext.Loader.loadScript({
        url: 'ext/locale/ext-lang-'+MyApp.currentUser.culture.toLowerCase()+'.js',
        onLoad: function() {
          // load app locale
          Ext.namespace('MyApp.locale');
          Ext.Loader.loadScript({
            url: 'app/locale/'+MyApp.currentUser.culture.toUpperCase()+'.js',
            onLoad: function() {

              // FINALLY, set up viewport
              var viewport = Ext.create('MyApp.view.Viewport', {
                controller: app
              });

              if (MyApp.util.hasPermission('usermgmt'))
                app.getController('Locations');

              // and so on ...

            }
          });
        }
      });
    });
  }
}); // end application

Is there any other, more elegant way to write this code? I know there are libraries for async flow, but can any of these work with the Ext JS API here? Or can I somehow force Ext.syncRequire to load the locales for me (so I only have one layer of nesting for the getGlobals call)? My own locales have a class defined, but Ext locales don’t. Also, will this somehow mess up compiling the source files with Sencha Cmd?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:40:55+00:00Added an answer on June 18, 2026 at 11:40 am

    Your concept is a bit weird therefore I have some recommendations for you. I use direct in many projects and most them had the need for localization and rather complex AC-Managements.

    • Your app should not have the need to resolve or load something before it even starts.
    • Language & localization should be provided the time the main application view get loaded
    • Your frontend should never resolve any access control. You can (for most situations) perfectly achieve this with the direct API
      • reduce the API to these actions where the user have access (this also happens when the application main view get prepared)

    That make your app faster and your life easier.

    Update

    The time the user login or just request the mainview you should have plenty information like the supported browser language or at least when the user selects a language. With that knowledge you just need to prepare the view.

    A acl within a frontend is not secure and need to be rechecked at serverside it should therefore be avoided or simple. The simplest way with direct is to provide a API matching the user access and check for this within the frontend. That is a sort of implicit access control. How to implement this depends on the on the UI, but there are many ways

    Update 2

    Why don’t you provide one build per language? I don’t see any reason against it. Or split the framework from your application & classes which allows you to update while the clients can still use the cached framework lib.

    The API can be easily checked for controller (backend) access and method (backend) access. Where the controller may be your tab and the actions your menu elements. Cause the API is global available you just need to check if the objects or properties exists. Let’s pretend we have a backend-controller named Car and Method called Drive we can check for this like

    if (Car) {
        // has controller access
        if (Car.Dirve) {
            // has access to the 'drive' action
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JSon response to parse title,date content and thumbnail images and place
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.