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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:42:15+00:00 2026-06-12T15:42:15+00:00

I gave it a try but it did not worked. I am having two

  • 0

I gave it a try but it did not worked.

I am having two grids and a button. Initially the second grid will remain empty and the first grid will have some records.. When I select a few records in the first grid and click on the button, then the second grid should get populated with the only the selected rows of first grid.

Here is my code:

Ext.QuickTips.init();

var getLocalStore = function() {
    return Ext.create('Ext.data.ArrayStore', {
        model: 'Company',
        data: Ext.grid.dummyData
    });
};

var getSelectedStore = function() {
    return Ext.create('Ext.data.ArrayStore', {
        model: 'Company'
    });
};

var sm = Ext.create('Ext.selection.CheckboxModel');

var grid1 = Ext.create('Ext.grid.Panel', {
    id: 'grid1',
    store: getSelectedStore(),
    columns: [
        {text: "Company", width: 200, dataIndex: 'company'},
        {text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
        {text: "Change", dataIndex: 'change'},
        {text: "% Change", dataIndex: 'pctChange'},
        {text: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
    ],
    columnLines: true,
    width: 600,
    height: 300,
    frame: true,
    title: 'Framed with Checkbox Selection and Horizontal Scrolling',
    iconCls: 'icon-grid',
    renderTo: 'grid1'
});

var grid2 = Ext.create('Ext.grid.Panel', {
    id: 'grid2',
    store: getLocalStore(),
    selModel: sm,
    columns: [
        {text: "Company", width: 200, dataIndex: 'company'},
        {text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
        {text: "Change", dataIndex: 'change'},
        {text: "% Change", dataIndex: 'pctChange'},
        {text: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
    ],
    columnLines: true,
    width: 600,
    height: 300,
    frame: true,
    title: 'Framed with Checkbox Selection and Horizontal Scrolling',
    iconCls: 'icon-grid',
    renderTo: 'grid'
});  

Ext.widget('button', {
text: 'Click Me',   
renderTo: 'btn',
listeners: {
    click: function(this1, evnt, eOpts ){               
        var records = sm.getSelection();
        getSelectedStore().loadData(records,true);
        grid1.getView().refresh();
        /*Ext.each(records, function (record) {
            alert(record.get('company'));
        });*/
    }
}
});

Please let me what’s going wrong.

  • 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-12T15:42:16+00:00Added an answer on June 12, 2026 at 3:42 pm

    First, you are defining the functions getSelectedStore and getLocalStore which return new store instances when invoked. That way in your click handler you would be grabbing an empty store each time! Lose the function bit and just set variables like this:

    var storeToSelectFrom = Ext.create('Ext.data.ArrayStore', {
        model: 'Company',
        data: someDataToChooseFrom
    });
    
    var storeToPutTo = Ext.create('Ext.data.ArrayStore', {
        model: 'Company'
    });
    

    Then, define your grids using those variables as the stores:

    var grid1 = Ext.create('Ext.grid.Panel',{
        store: storeToSelectFrom,
        selType: 'checkboxmodel'
        // rest of your configs
    });
    
    var grid2 = Ext.create('Ext.grid.Panel',{
        store: storeToPutTo
        // rest of your configs
    });
    

    Then, create the button with a click handler:

    Ext.widget('button', {
        handler: function (button, event) {
            var selected = grid1.getSelectionModel().getSelection();
            grid2.getStore().add(selected);
        }
        // rest of your configs
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send email with my gmail account, I gave it a try,
I gave to Google Guice the responsibility of wiring my objects. But, how can
Now i know that this one is actually not a very technical question but
I'm totally new to Perl, but I'd like to try it out. I read
I've been trying to get into LWJGL. But the things I try don't seem
Just did a brew install graphviz on Mountain Lion which gave me this error
I need to convert the following two working queries into a single query but
I had asked an earlier question which did not get any replies. Basically I
This is not a duplicate of How to set SWT button foreground color? .
Perhaps I should split this into separate questions, but having tried all of 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.