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

  • SEARCH
  • Home
  • 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 6384847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:49:34+00:00 2026-05-25T02:49:34+00:00

There are menu button (clients), tree panel with clients list (sorted by name) and

  • 0

There are menu button (“clients”), tree panel with clients list (sorted by name) and viewer with selected client details. There is also selectionchange action..

My task – on button click switch to client view and select and load details for first client every time button has been clicked. My problem – store is not loaded, how waiting until ext js will autoload data to the store?

my controller code:

    me.control({
        '#nav-client': {
            click: me.onNavClientClick
        },
    ...
        'clientlist': {
        //    load: me.selectClient,
            selectionchange: me.showClient
        }
    });

    onNavClientClick: function(view, records) {
        var me = this,
            content = Ext.getCmp("app-content");
        content.removeAll();
        content.insert(0, [{xtype: 'clientcomplex'}]);
        var first = me.getClientsStore().first();

        if (first) {
            Ext.getCmp("clientList").getSelectionModel().select(me.getClientsListStore().getNodeById(first.get('clientId')));
        }
    },
...

Two main questions:

  • is it good solution in my case? (to select first client in tree panel)

    var first = me.getClientsStore().first(); 
    // i use another store to get first record because of i dont know how to get first record (on root level) in TreeStore
    ...
    Ext.getCmp("clientList").getSelectionModel().select(me.getClientsListStore().getNodeById(first.get('clientId')));
    

i know this code works ok in case of “load: me.selectClient,” (but only once),

  • if i place this code on button click – i see error

    Uncaught TypeError: Cannot read property 'id' of undefined
    

because of me.getClientsListStore() is not loaded.. so how to check loading status of this store and wait some until this store will be completely autoloaded?..

Thank you!

  • 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-05-25T02:49:35+00:00Added an answer on May 25, 2026 at 2:49 am

    You can listen the store ‘load’ event. Like this:

    ...
    onNavClientClick: function(view, records) {
      var me = this;
    
      // if the store isn't loaded, call load method and defer the 'client view' creation
      if (me.getClientsStore.getCount() <= 0) {
        me.getClientsStore.on('load', me.onClientsStoreLoad, me, { single : true});
        me.getClientsStore.load();
      }
      else {
        me.onClientsStoreLoad();
      }
    },
    
    onClientsStoreLoad : function () {
        var me = this,
            content = Ext.getCmp("app-content");
        content.removeAll();
        content.insert(0, [{xtype: 'clientcomplex'}]);
        var first = me.getClientsStore().first();
    
        if (first) {
            Ext.getCmp("clientList").getSelectionModel().select(me.getClientsListStore().getNodeById(first.get('clientId')));
        }
    },
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are lots of java apps on my simulator menu screen which I have
There doesn't seem to be a default context menu (with copy, paste, etc.) for
Is there a way to display the dropdown menu shown on sitepoint by mouse
Is there an option to enable the drop down menu that appears when coding
Is there a way I can have a custom quick launch menu on a
Is there a way in Delphi 7 to find out if a pop-up menu
Is there a class that overwrites the .MainMenu_MenuItem class for the Main Menu? I
I am implementing the superfish menu and have noticed that there is a funny
What is the way (if there is a way) to customize the menu (the
Referring to the Configuration Manager under the Build menu, Is there a way to

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.