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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:07:59+00:00 2026-06-18T00:07:59+00:00

Normally, to define a grid type, I do something like this: Ext.define(‘MyApp.view.MyGrid’, { extend:

  • 0

Normally, to define a grid type, I do something like this:

Ext.define('MyApp.view.MyGrid', {
  extend: 'Ext.grid.Panel',
  alias: 'widget.myGrid',
  store: 'MyStore',
  columns: [...],
}

and then I add it to a container or layout via its xtype, ‘myGrid’.

What I want to do is define a reusable custom component that either extends Ext.grid.Panel or accepts the same configs (such as columns), but is really a container that contains a grid and other stuff.

Ext.define('MyApp.components.ContainedGrid', {
  extend: 'Ext.container.Container' //or Ext.grid.Panel, whatever works
  alias: 'widget.containedGrid',
  layout: 'card',
  items: [
    {someObject}, //doesn't matter what this is
    {aGrid}, //the grid that should receive the configs from the caller
  ],
}

Ideally, this component could be configured like a regular Ext.grid.Panel object, and those configurations should be really apply to the grid defined second in the items array.

In other words, something like the following should render a window containing a card layout, where the second card should be the grid, with the columns & store provided to the container.

Ext.create('Ext.window.Window',  {
  title: 'hi',
  layout: 'fit',
  items: {
    xtype: 'containedGrid',
    store: myStore,
    columns: [...],
  },
});

Logically, I just want to say that the configs provided to the container apply to one of its components, but I don’t know how to execute that. Any thoughts?

Edit:
To be succinct, what I’m trying to do is create a component that is configured just like a grid, but is really a container that includes a grid, along with some other stuff. This component will be used several times, so I’d like to package it as a reusable component.

  • 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-18T00:08:00+00:00Added an answer on June 18, 2026 at 12:08 am

    Define a property for the gridconfig

    Ext.define('MyApp.components.ContainedGrid', {
      extend: 'Ext.container.Container' //or Ext.grid.Panel, whatever works
      alias: 'widget.containedGrid',
      layout: 'card',
      /**
       * @cfg {object} gridCfg
       */
    
      initComponent: function(){
         var gridCfg = { xtype: 'grid' };
         if(this.gridCfg)
              gridCfg = Ext.apply(gridCfg ,this.gridCfg);
         if (this.items) // we assume if set it will be always array!
              this.items.push(gridCfg);
         else
              this.items = [gridCfg];
         delete this.gridCfg; // we no longer need this property here
         this.callParent(arguments);
      }
    }
    

    And the usecase:

    Ext.create('Ext.window.Window',  {
      title: 'hi',
      layout: 'fit',
      items: {
        xtype: 'containedGrid',
        gridCfg: {
           store: myStore,
           columns: [...]
        }
      },
    });
    

    Update

    I think I now understand what you are looking for. To register listeners directly onto the container you need to relay the events. I’ve made a example that at least relay the events of the view (which should be most). You will be able to relay also events of the table and the features (features first after rendering). Here’s a JSFiddle that print all events from the container into the console.

    Ext.define('Ext.ux.ContainedGrid', {
          extend: 'Ext.container.Container',
          alias: 'widget.containedGrid',
          layout: 'card',
          /**
           * @cfg {object} gridCfg
           */
    
          /**
           * @private {object} grid
           */
          initComponent: function(){
             var me = this,
                 grid;
             // provide some default settings for the grid here, 
             // which can be overriden by each instance
             var gridCfg = { }; // the defaulttype is defined on the componentmanager call
             me.gridCfg = me.gridCfg ? Ext.apply(gridCfg ,me.gridCfg) : gridCfg;
    
             me.grid = me.getGrid();
    
             if (me.items && Ext.isArray(me.items)) 
                  me.items.push(me.grid);
             else if(me.items)
                  me.items = [me.items, me.grid];
             else
                  me.items = [me.grid];
             delete me.gridCfg; // we no longer need this property here
             // Relay events from the View whether it be a LockingView, or a regular GridView
             this.relayEvents(me.grid, [
                    /**
                     * @event beforeitemmousedown
                     * @inheritdoc Ext.view.View#beforeitemmousedown
                     */
                    'beforeitemmousedown',
                    /**
                     * @event beforeitemmouseup
                     * @inheritdoc Ext.view.View#beforeitemmouseup
                     */
                    'beforeitemmouseup',
                    /**
                     * @event beforeitemmouseenter
                     * @inheritdoc Ext.view.View#beforeitemmouseenter
                     */
                    'beforeitemmouseenter',
                    /**
                     * @event beforeitemmouseleave
                     * @inheritdoc Ext.view.View#beforeitemmouseleave
                     */
                    'beforeitemmouseleave',
                    /**
                     * @event beforeitemclick
                     * @inheritdoc Ext.view.View#beforeitemclick
                     */
                    'beforeitemclick',
                    /**
                     * @event beforeitemdblclick
                     * @inheritdoc Ext.view.View#beforeitemdblclick
                     */
                    'beforeitemdblclick',
                    /**
                     * @event beforeitemcontextmenu
                     * @inheritdoc Ext.view.View#beforeitemcontextmenu
                     */
                    'beforeitemcontextmenu',
                    /**
                     * @event itemmousedown
                     * @inheritdoc Ext.view.View#itemmousedown
                     */
                    'itemmousedown',
                    /**
                     * @event itemmouseup
                     * @inheritdoc Ext.view.View#itemmouseup
                     */
                    'itemmouseup',
                    /**
                     * @event itemmouseenter
                     * @inheritdoc Ext.view.View#itemmouseenter
                     */
                    'itemmouseenter',
                    /**
                     * @event itemmouseleave
                     * @inheritdoc Ext.view.View#itemmouseleave
                     */
                    'itemmouseleave',
                    /**
                     * @event itemclick
                     * @inheritdoc Ext.view.View#itemclick
                     */
                    'itemclick',
                    /**
                     * @event itemdblclick
                     * @inheritdoc Ext.view.View#itemdblclick
                     */
                    'itemdblclick',
                    /**
                     * @event itemcontextmenu
                     * @inheritdoc Ext.view.View#itemcontextmenu
                     */
                    'itemcontextmenu',
                    /**
                     * @event beforecontainermousedown
                     * @inheritdoc Ext.view.View#beforecontainermousedown
                     */
                    'beforecontainermousedown',
                    /**
                     * @event beforecontainermouseup
                     * @inheritdoc Ext.view.View#beforecontainermouseup
                     */
                    'beforecontainermouseup',
                    /**
                     * @event beforecontainermouseover
                     * @inheritdoc Ext.view.View#beforecontainermouseover
                     */
                    'beforecontainermouseover',
                    /**
                     * @event beforecontainermouseout
                     * @inheritdoc Ext.view.View#beforecontainermouseout
                     */
                    'beforecontainermouseout',
                    /**
                     * @event beforecontainerclick
                     * @inheritdoc Ext.view.View#beforecontainerclick
                     */
                    'beforecontainerclick',
                    /**
                     * @event beforecontainerdblclick
                     * @inheritdoc Ext.view.View#beforecontainerdblclick
                     */
                    'beforecontainerdblclick',
                    /**
                     * @event beforecontainercontextmenu
                     * @inheritdoc Ext.view.View#beforecontainercontextmenu
                     */
                    'beforecontainercontextmenu',
                    /**
                     * @event containermouseup
                     * @inheritdoc Ext.view.View#containermouseup
                     */
                    'containermouseup',
                    /**
                     * @event containermouseover
                     * @inheritdoc Ext.view.View#containermouseover
                     */
                    'containermouseover',
                    /**
                     * @event containermouseout
                     * @inheritdoc Ext.view.View#containermouseout
                     */
                    'containermouseout',
                    /**
                     * @event containerclick
                     * @inheritdoc Ext.view.View#containerclick
                     */
                    'containerclick',
                    /**
                     * @event containerdblclick
                     * @inheritdoc Ext.view.View#containerdblclick
                     */
                    'containerdblclick',
                    /**
                     * @event containercontextmenu
                     * @inheritdoc Ext.view.View#containercontextmenu
                     */
                    'containercontextmenu',
                    /**
                     * @event selectionchange
                     * @inheritdoc Ext.selection.Model#selectionchange
                     */
                    'selectionchange',
                    /**
                     * @event beforeselect
                     * @inheritdoc Ext.selection.RowModel#beforeselect
                     */
                    'beforeselect',
                    /**
                     * @event select
                     * @inheritdoc Ext.selection.RowModel#select
                     */
                    'select',
                    /**
                     * @event beforedeselect
                     * @inheritdoc Ext.selection.RowModel#beforedeselect
                     */
                    'beforedeselect',
                    /**
                     * @event deselect
                     * @inheritdoc Ext.selection.RowModel#deselect
                     */
                    'deselect'
                ]);
             me.callParent(arguments);
          },
          getGrid: function() {
             if(this.grid)
                 return this.grid;
             return this.grid = Ext.ComponentManager.create(this.gridCfg,'grid');;
          }
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Normally this would be something like: glutAddMenuEntry(-, <opid>); But it doesn't work. After looking
I have a query (a view actually) the normally should define a unique mapping
Normally the XML files I have to parse are like this: <row id=1> <title>widget<title>
Normally, I've seen prototype functions declared outside the class definition, like this: function Container(param)
Normally, you define init or initWith... methods and call them inside convenient constructors like
We have a macro for error-checking that goes like this: #define CheckCondition( x )
I have a C header file like this: #ifndef RENDERER_H #define RENDERER_H static int
Normally, you define a boost::signals2::signal like so: typedef boost::signals2::signal<void (int)> MySignalType; MySignalType mySignal; and
This question comes from issues raised by this answer . Normally, we define copy
Normally, if I want to start a new activity I can use StartActivity(typeof(foo)); This

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.