Is there a method to check the control of what is the xtype of the root control?

  1. #1

    Is there a method to check the control of what is the xtype of the root control?

    I have a formPanel that has 4 controls and one of them is a _tab2BGrid.
    Which is called MainTabGrid and that extend to another control called GridPanelControl and that is extended from the grid panel control.
    I want to be able to check if my control has control of xtype grid.
    if (this._tab2BGrid.Contains(xtype.Grid)) {
                    check store and do other stuff.
    }

    This is how they extend to each other:
     Ext.define('App.Win.TabContainters.TabContainersMain', (function() {
    		var publicInterface = {
    			extend: 'Ext.form.FormPanel',
    			_tab1A: null,
    			_tab2BGrid: null,
    			_tab3C: null,
    			_tab4D: null, 
    
    
     Ext.define('ALA.Win.PiecesGrid', (function() {
    		var publicInterface = {
    			extend: 'App.Ext.GridPanelControl', 
    
     Ext.define('ALA.Ext.GridPanelControl', (function () {
    		var publicInterface = {
    			extend: 'Ext.grid.Panel',
    Last edited by juan; Apr 02, 2019 at 7:10 PM.
  2. #2
    Hello, @juan!

    I believe you want the component's Ext.grid.Panel.down(selector) method. For example, if you have a panel with a window inside, and then a fieldset then a button, you can just go, from the panel:

    App.MyPanel1.down('button');
    And the button will be returned. This also works, say, if you have a GridPanel with a button in its TopBar or BottomBar. For instance, in the Simple GridPanel example, if you open developer tools, then type in the console:

    App.GridPanel1.down('button');
    You'll get the 'print' button. Beware it only returns the first match, so in case you are asking yourself about getting anything within a component that matches the xtype, you're looking for the Ext.grid.Panel.query() method.

    These down(), query() (and also up()) comes from a common space and is available in many components from Ext JS, anything that inherits directly or indirectly from Ext.mixin.Queryable would have this (so we can't say for sure which components exactly inherit, just check their documentation if there's the methods or inheritance tree with the corresponding elements).

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi @fabricio.murta

    Thank you for your reply that worked for me!
  4. #4
    Glad it helped, thanks for the feedback!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Custom Control overriding "XType"
    By edip in forum 4.x Help
    Replies: 0
    Last Post: Oct 02, 2018, 5:17 PM
  2. Replies: 1
    Last Post: Jan 26, 2015, 3:42 PM
  3. Replies: 1
    Last Post: Jul 25, 2011, 9:59 AM
  4. Replies: 8
    Last Post: Jan 25, 2011, 4:21 AM
  5. Replies: 4
    Last Post: Nov 22, 2010, 11:07 PM

Tags for this Thread

Posting Permissions