Loading all stores simultaneously in ExtJS

In my application.js file, I have defined the code snippet below. It includes a long list of stores and views that need to be loaded.

The issue arises because these components are loaded asynchronously. This means that if a user clicks a button before a store has finished loading, it may not work as expected.

One potential solution would be to load a store only when it is required. Alternatively, is there a better way to address this problem?

Ext.define('RateManagement.Application', {
    name: 'RateManagement',

    extend: 'Ext.app.Application',

    views: [
        // List of views
        'RateManagement.view.Grids.CountryRateGrid',
        'RateManagement.view.Grids.LocationRateGrid',
        ...
        'RateManagement.view.Grids.AirfareRateGrid'
    ],

    controllers: [
        // List of controllers
    ],

    stores: [
        // List of stores
        'RateManagement.store.CountryStore',
        'RateManagement.store.CurrencyStore',
        ...
        'RateManagement.store.AirfareStore'
    ],

    models: [
        // List of models
        'RateManagement.model.Country',
        'RateManagement.model.Currency',
        ...
        'RateManagement.model.AirfareRate'
    ],

    launch: function() {
        // App launch code

        // Stupid fix for a bug
        Ext.override(Ext.grid.RowEditor,{
            // Code for row editor
        });
    }
});

Answer №1

One effective approach is to leverage controllers:

By utilizing controllers, you can divide your application bootstrap class into smaller controllers that are triggered and loaded as required. These controllers can have dependencies on models, stores, and views, which are loaded when a new instance of the controller is generated (for instance, when a user initiates opening a new window).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Guide to creating a unique React component for displaying a single popup upon clicking with the ability to pass props to it

As someone who is still learning React, I decided to challenge myself by creating a Jeopardy game using this framework. My current idea is to have a popup appear when a player clicks on a box on the Jeopardy board, displaying the clue associated with that ...

Automatically reconstructing local packages when changes occur

After installing a local package using npm local paths, I am looking for a way to automatically rebuild or re-install the package whenever I make changes to the file. Can anyone help me with this? I have searched online extensively but haven't come a ...

Looking to extract data from JavaScript using Scrapy 1.4.0?

Apologies for my lack of proficiency in English. As a beginner in scrapy, I am seeking guidance on an issue I encountered while trying to scrape a particular website. Below is the code for my spider: import scrapy from bs4 import BeautifulSoup as bs clas ...

Achieving a delayed refetch in React-Query following a POST请求

Two requests, POST and GET, need to work together. The POST request creates data, and once that data is created, the GET request fetches it to display somewhere. The component imports these hooks: const { mutate: postTrigger } = usePostTrigger(); cons ...

What could be causing my token to not save after registering a user?

I am currently facing an issue when submitting a registration form. While the user is successfully created, the token is not stored in localStorage, which prevents me from being redirected immediately to the app and forces me to log in again. Here is my R ...

Inject a heavy dose of Vue into your project

**I'm trying to implement the provide/inject logic in Vue. In my 'App.vue' component, I have defined the 'firstName' input as a string "John", and I want to display this value when the child component 'Step1' is created. ...

How can we modify the elements within an Object tag in HTML? If it is achievable, what is the process?

I am working on a project involving an HTML page that includes content from an external website using an HTML object tag as shown below: <object data="someUrl-on-different-domain-than-host" type="text/html"></object> My goal is to use jQuery ...

Is there a way to halt the compiler until an Ajax request is fully processed?

Within my form, there is a field labeled parent keywords as a secret key. The validation of this form using JavaScript functions smoothly. It is designed to check if the secret key is associated with any parent or not. If not, the value is set to 0 by defa ...

Invoke a function only once in a Node.js application

What is the best way to execute a method only once when starting a node application? I am considering placing it in server.js, the executable file of my application, but I'm unsure if this is the correct approach. Are there any other options I should ...

Store the numeric value in JavaScript as a PHP integer

My goal is to obtain the width of the browser and then compare it as a PHP variable. However, the issue I am facing is that it is being saved as a string, and my attempts at parsing it to another variable only result in returning 0. $tam='<script& ...

Tips for obtaining a unique ID while hovering over each individual td element within a while loop

Whenever I hover over a specific td, I expect to see a unique timecard_id_overtime. However, the issue is that I always end up getting the last id in the while loop. I attempted using id instead of class, but unfortunately, this approach did not solve th ...

Finding strikeout text within <s> or <del> tags can be identified by closely examining the HTML codes

The issue arises with the text that reads as follows: 316.6.1 Structures. Structures shall not be constructed This is represented in HTML as: <b> <s> <span style='font-size:10.0pt'>316.6.1 Structures</span> ...

Storing the path of a nested JSON object in a variable using recursion

Can the "path" of a JSON object be saved to a variable? For example, if we have the following: var obj = {"Mattress": { "productDelivered": "Arranged by Retailer", "productAge": { "ye ...

Windows users can rely on auto-saving, but Mac users may need to find another solution

I tried the solution provided in this discussion thread (Saving without dialog window) to save an image as PNG without triggering the 'Save as..' dialog. It worked perfectly on my Windows computer. However, when I shared the script with my collea ...

Invoking res.download() in the Express framework

It's puzzling why this issue is occurring, and it's quite frustrating. I was expecting the file to be downloaded in line with the guidelines provided in the Express documentation. Below is the code snippet I am using: //within React (App.js) ...

Issue with calling jQuery method from the view in C# not executing the function as expected

I am trying to implement jQuery in a view, but I am facing an issue where the backend method is not being triggered as expected. I need some additional eyes to help me figure out why it's not working properly. <script src="../Scripts/jquery-1.7.1. ...

What adjustments can I make to my smooth-scrolling JavaScript code in order to exclude my Bootstrap Carousel from the scrolling

On my website, I have incorporated JavaScript to create a smooth-scrolling effect when a user clicks on a hyperlink. This feature is essential as the landing page includes a chevron-down icon that prompts the user to navigate to the next section of the pag ...

Sending data from a child component to a parent component in React

Trying to figure out how to pass the returned value of function appColor from the WeatherForecast component into a property, and then passing that property from WeatherForecast to the className of the app component. I'm new to React, so not sure how t ...

AngularJS $q - pausing execution to synchronize all promises

I've encountered a challenge that I haven't been able to solve through online searches. In my project, I am using a library for selecting items and performing custom modifications through callback functions. However, I need to execute some async ...

Reset all divs to their default state except for the one that is currently active using jQuery

Here's the plan for my script: Once a user clicks on a "learn more" button, it will reveal the relevant information in the corresponding box. I'm aiming to implement a feature where if you click on another "learn more" button while one box is a ...