PDA

View Full Version : moving items between grids



ruchika
9 Feb 2010, 4:20 AM
Hi,
i have 2 grids with 2 different stores and a button for copy all. On click of the button i want to move all the items from 1st grid to the second. how do i achieve the same. My grid and stores are as below:


selFieldsStore = new Ext.data.JsonStore({
storeId: 'selFieldsStore',
idIndex: 0,
root:'columns',
fields:
[
{name: 'columnname', mapping:'columnName'},
{name: 'record', convert:getRecord}
]
});

// create the destination Grid
secondGrid = new Ext.grid.GridPanel({
id : 'secondgrd',
ddGroup : 'firstGridDDGroup',
store : selFieldsStore,
columns : cols,
enableDragDrop : true,
stripeRows : true,
autoExpandColumn : 'columnname',
frame : false,
header : true,
flex : 1 ,
enableHdMenu : false,
enableColumnMove : true,
selModel: new Ext.grid.RowSelectionModel({singleSelect:false }),
title : 'Selected Fields'
});

avlFieldsStore = new Ext.data.JsonStore({
storeId: 'avlFieldsStore',
idIndex: 0,
root:'columns',
fields:
[
{name: 'columnname', mapping:'columnName'},
{name: 'record', convert:getRecord}
]
});
// declare the source Grid
firstGrid = new Ext.grid.GridPanel({
id : 'firstgrd',
ddGroup : 'secondGridDDGroup',
store : avlFieldsStore,
columns : cols,
enableDragDrop : true,
stripeRows : false,
autoExpandColumn : 'columnname',
frame : false,
header : true,
title : 'Available Fields',
enableHdMenu : false,
selModel: new Ext.grid.RowSelectionModel({singleSelect:false }),
flex : 1
});