PDA

View Full Version : Filling a grid from another grid



prijithkr
2 Jul 2012, 7:58 PM
I have a Grid, with checkbox in each row, so that whenever I select a few records and click on a common edit button outside, a popup window should appear & only those records should get populated in the table,

I have created both the grids and the popup, but how will i be able to fill the pop up grid, with the selected value of the main grid?

what will be the store of the pop grid? should i use the same store or is there anyother option!!

sword-it
3 Jul 2012, 12:04 AM
Hi!
Try this:-

when you click on edit button, get all the selected records from your grid by following:-



// Your Button Handler
handler:function(){
// find your grid here and get selected records by following
var selected = grid.getSelectionModel().getSelection();
openNewWindowGrid(selected);
}



openNewWindowGrid() creates a grid inside a window.
when creating your window's grid, try the following:-




var newStore = Ext.create('Ext.data.Store', {
storeId: 'newWindowGridStore',
fields: ['name', 'phone'],
data: selected
...
...
});



and feed newWindowGridStore to your window's grid as:-




Ext.create('Ext.grid.Panel', {
title: 'Window Grid',
store: Ext.data.StoreManager.lookup('newWindowGridStore'),
columns: [
.....
]
...
...
});