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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:44:03+00:00 2026-05-30T11:44:03+00:00

I have the following extjs code that createa 2 tabs and a grid. How

  • 0

I have the following extjs code that createa 2 tabs and a grid.

How can I go about adding the grid inside a tab?

Ext.require('Ext.tab.*');
Ext.require([
    'Ext.data.*',
    'Ext.grid.*'
]);

//Tab

Ext.onReady(function(){

    Ext.create('Ext.tab.Panel',{
    renderTo:'tabs2',
width: 600,
        height: 250,
        plain: true,
        defaults :{
            autoScroll: true,
            bodyPadding: 10
        },
    items:[{
           title:'Foo'
           },
           {
            title:'Bar',
            tabConfig: {
               title:'Custom title',    
            tooltip: 'A button tooltip' 
             }
           }]

    });



});

//grid

Ext.onReady(function(){
    Ext.define('Book',{
        extend: 'Ext.data.Model',
        fields: [
            // set up the fields mapping into the xml doc
            // The first needs mapping, the others are very basic
            {name: 'Author', mapping: 'ItemAttributes > Author'},
            'Title', 'Manufacturer', 'ProductGroup'
        ]
    });

    // create the Data Store
    var store = Ext.create('Ext.data.Store', {
        model: 'Book',
        autoLoad: true,
        proxy: {
            // load using HTTP
            type: 'ajax',
            url: 'sheldon-2.xml',
            // the return will be XML, so lets set up a reader
            reader: {
                type: 'xml',
                // records will have an "Item" tag
                record: 'Item',
                idProperty: 'ASIN',
                totalRecords: '@total'
            }
        }
    });

    // create the grid
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        columns: [
            {text: "Author", flex: 1, dataIndex: 'Author', sortable: true},
            {text: "Title", width: 180, dataIndex: 'Title', sortable: true},
            {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
            {text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
        ],
        renderTo:'example-grid',
        width: 540,
        height: 200
    });
});

Ext.onReady(function(){
    Ext.define('Book',{
        extend: 'Ext.data.Model',
        fields: [
            // set up the fields mapping into the xml doc
            // The first needs mapping, the others are very basic
            {name: 'Author', mapping: 'ItemAttributes > Author'},
            'Title', 'Manufacturer', 'ProductGroup'
        ]
    });

    // create the Data Store
    var store = Ext.create('Ext.data.Store', {
        model: 'Book',
        autoLoad: true,
        proxy: {
            // load using HTTP
            type: 'ajax',
            url: 'sheldon-2.xml',
            // the return will be XML, so lets set up a reader
            reader: {
                type: 'xml',
                // records will have an "Item" tag
                record: 'Item',
                idProperty: 'ASIN',
                totalRecords: '@total'
            }
        }
    });

    // create the grid
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        columns: [
            {text: "Author", flex: 1, dataIndex: 'Author', sortable: true},
            {text: "Title", width: 180, dataIndex: 'Title', sortable: true},
            {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
            {text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
        ],
        renderTo:'example-grid',
        width: 540,
        height: 200
    });
});

XML sheldon2.xml

<?xml version="1.0" encoding="utf-8"?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2006-06-28">
    <OperationRequest>
        <HTTPHeaders>
            <Header Name="UserAgent"
                    Value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser; Avant Browser; .NET CLR 1.0.3705; .NET CLR 2.0.50727; .NET CLR 1.1.4322; Media Center PC 4.0; InfoPath.2)"></Header>
        </HTTPHeaders>
        <RequestId>18CZWZFXKSV8F601AGMF</RequestId>
        <Arguments>
            <Argument Name="Service" Value="AWSECommerceService"></Argument>
            <Argument Name="AssociateTag" Value="ws"></Argument>
            <Argument Name="SearchIndex" Value="Books"></Argument>
            <Argument Name="Author" Value="Sidney Sheldon"></Argument>
            <Argument Name="SubscriptionId" Value="1A7XKHR5BYD0WPJVQEG2"></Argument>
            <Argument Name="Version" Value="2006-06-28"></Argument>
            <Argument Name="Operation" Value="ItemSearch"></Argument>
        </Arguments>
        <RequestProcessingTime>1.05041599273682</RequestProcessingTime>
    </OperationRequest>
    <Items>
        <Request>
            <IsValid>True</IsValid>
            <ItemSearchRequest>
                <Author>Sidney Sheldon</Author>
                <SearchIndex>Books</SearchIndex>
            </ItemSearchRequest>
        </Request>
        <TotalResults>203</TotalResults>
        <TotalPages>21</TotalPages>
        <Item>
            <ASIN>0446355453</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446355453%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446355453%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>Master of the Game</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446613657</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446613657%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446613657%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>Are You Afraid of the Dark?</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446357421</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446357421%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446357421%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>If Tomorrow Comes</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446607207</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446607207%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446607207%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Vision</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>Tell Me Your Dreams</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446357448</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446357448%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446357448%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>Bloodline</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446532673</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446532673%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446532673%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>The Other Side of Me</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446356573</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446356573%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446356573%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>A Stranger in the Mirror</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0060198346</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0060198346%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0060198346%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>William Morrow &amp; Company</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>The Sky Is Falling</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446354732</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446354732%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446354732%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>Nothing Lasts Forever</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>0446341916</ASIN>
            <DetailPageURL>
                http://www.amazon.com/gp/redirect.html%3FASIN=0446341916%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446341916%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
            </DetailPageURL>
            <ItemAttributes>
                <Author>Sidney Sheldon</Author>
                <Manufacturer>Warner Books</Manufacturer>
                <ProductGroup>Book</ProductGroup>
                <Title>The Naked Face</Title>
            </ItemAttributes>
        </Item>
    </Items>
</ItemSearchResponse>
  • 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-30T11:44:08+00:00Added an answer on May 30, 2026 at 11:44 am

    You shouldn’t render grids if you want add them to container. Basically you should create TabPanel and add 2 items to it. There is no difference if you add grid or anything else.

    Example code:

    Ext.onReady(function(){
        Ext.define('Book',{
            extend: 'Ext.data.Model',
            fields: [
                // set up the fields mapping into the xml doc
                // The first needs mapping, the others are very basic
                {name: 'Author', mapping: 'ItemAttributes > Author'},
                'Title', 'Manufacturer', 'ProductGroup'
            ]
        });
    
        // create the Data Store
        var store1 = Ext.create('Ext.data.Store', {
            model: 'Book',
            autoLoad: true,
            proxy: {
                // load using HTTP
                type: 'ajax',
                url: 'sheldon-1.xml',
                // the return will be XML, so lets set up a reader
                reader: {
                    type: 'xml',
                    // records will have an "Item" tag
                    record: 'Item',
                    idProperty: 'ASIN',
                    totalRecords: '@total'
                }
            }
        });
    
        // create the Data Store
        var store2 = Ext.create('Ext.data.Store', {
            model: 'Book',
            autoLoad: true,
            proxy: {
                // load using HTTP
                type: 'ajax',
                url: 'sheldon-2.xml',
                // the return will be XML, so lets set up a reader
                reader: {
                    type: 'xml',
                    // records will have an "Item" tag
                    record: 'Item',
                    idProperty: 'ASIN',
                    totalRecords: '@total'
                }
            }
        });
    
        // create the grid
        var grid1 = Ext.create('Ext.grid.Panel', {
            store: store1,
            columns: [
                {text: "Author", flex: 1, dataIndex: 'Author', sortable: true},
                {text: "Title", width: 180, dataIndex: 'Title', sortable: true},
                {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
                {text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
            ],
            title: 'Grid1'
        });
    
        // create the grid
        var grid2 = Ext.create('Ext.grid.Panel', {
            store: store2,
            columns: [
                {text: "Author", flex: 1, dataIndex: 'Author', sortable: true},
                {text: "Title", width: 180, dataIndex: 'Title', sortable: true},
                {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
                {text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
            ],
            title: 'Grid2'
        });
    
        Ext.create('Ext.TabPanel', {
            renderTo: Ext.getBody(),
            items: [
                grid1, grid2
            ]
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ExtJS grid with the following: // Initialize the state manager Ext.state.Manager.setProvider(new
I have following code i want that window opened uses Ext.layout.BorderLayout and also on
I am using the ExtJS framework and I have the following handler that is
I have the following code in extjs and while rendering it is giving me
I am building a login window with ExtJs, using the following code : Ext.define('DTL.view.windows.LoginWindow',
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
I'm using the Sencha ExtJS Framework in Version 4.05 and i have the following
i have following problem To decode the Biquinary code use the number 5043210. At

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.