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 8309127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:00:53+00:00 2026-06-08T19:00:53+00:00

There are two major ways in getting components in ExtJS 4. By a global

  • 0

There are two major ways in getting components in ExtJS 4. By a global ID or by a relative path.

The ID approach has the benefit of finding any component independent of it actual position within the view. So when the view changes, the system still works. But as the system gets bigger and bigger I need to use IDs with namespaces and implement some mechanism to generate unique IDs for multiple instances of a component.

When I use relative navigation with component queries, I don’t have to worry about IDs and just navigate, for example, from the clicked button to the grid I want to change and do it. But when the view changes it’s possible that the query doesn’t work anymore and the system breaks.

So both of the approaches seem suboptimal.

Is there any better method?

After reading the answers here I’m using this approach:

In the views I define my components with a lid (local ID) which has to be unique it’s siblings, but not globally unique like id.

Now I can use queries like this:

someWindowInstances[0].query( 'button[lid=myButton]' );

...

someWindowInstances[n].query( 'button[lid=myButton]' );

This enables “myButton” to be anywhere in the windows and if the window view changes, I still find it.

  • 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-08T19:00:54+00:00Added an answer on June 8, 2026 at 7:00 pm

    If by relative path you mean query() method, then that’s the way to go. Don’t forget that you can query a component not only by DOM attributes, but by its xtype and basically any object property. Like this:

    var panel = new Ext.panel.Panel({
        items: [{
            xtype: 'button',
            prop:  'foo'
        }],
    
        renderTo: Ext.getBody()
    });
    
    var button = panel.query('button[prop="foo"]')[0];
    

    Actually, this is one of the most powerful and less known features of Ext JS 4. Be descriptive, use query() instead of Ext.getCmp() and you’ll get much better code: easy to read and maintain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any major differences between the two? I have yet to see a
I want to design this system which has two major components: Base/core stuff. Never
Is there any major difference between the two? Is there anything that can be
There are two major refactoring tools which can be installed for Visual Studio that
There are two major fix engines: opensource QuickFix http://www.quickfixengine.org/ commercial Fix Antenna http://www.b2bits.com/trading_solutions/fix_engines/fix_engine_cpp.html What
There are two major means of data binding initialization, but there is a drawback
I guess there are two major approaches to date representations in XML: <date>1984-10-27</date> and
There seems to be two major conventions for organizing project files and then many
Checking the Xerces-C++ webpage , I saw there are two major branches of the
There are two ways to implement overloads. The first one is to do everything

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.