PDA

View Full Version : Double Grid exchanger to move rows from one grid to another



sephyroth69
11 May 2012, 2:45 AM
I don't know all components in ExtJs and plugins :
Is there a built in component to do so ?

The idea is to have 2 grids put side by side and several buttons to move items from one to the other.

friend
11 May 2012, 3:36 AM
Take a look at examples/dd/dnd_grid_to_grid.html in your ExtJs installation. It already does all the drag and drop, all you need do is add buttons (if desired).

sephyroth69
11 May 2012, 3:49 AM
Perfect ! Thanks a lot.

Nxs
21 Jun 2012, 12:00 AM
Hey,

I'm looking for a solution to move all records from one grid to another grid with one button and vice-versa with another button.

How to simulate a d&d with a full selection ? Or have I to handle the move fully manually by removing records from the source grid and insert them into the target grid ?

Is there any simply way to achieve this ?

Thanks.

Nxs
21 Jun 2012, 1:16 AM
Hey,

I'm looking for a solution to move all records from one grid to another grid with one button and vice-versa with another button.

How to simulate a d&d with a full selection ? Or have I to handle the move fully manually by removing records from the source grid and insert them into the target grid ?

Is there any simply way to achieve this ?

Thanks.

Ok I finally do the trick like this :



// Destination Grid
var gridDest = Ext.getCmp('importGridMajBddHeaders');

// We look for all records in the source grid
Ext.each(grid.store.data.items, function (rec) {
// We check if the record is already present in DestGrid

var foundItem = gridDest.store.findExact('Value', rec.data.Value);

// Record not found

if (foundItem == -1) {

// We add it

gridDest.store.add(rec);

}
});


// We remove sourceGrid records
grid.store.removeAll();


// We refresh the grid
grid.getView().refresh();

// Sometimes, scroll doesn't work anymore (bug in 4.0.7 ?)
// So I try to update Gui...
grid.doLayout();
grid.doComponentLayout();
grid.determineScrollbars();
grid.invalidateScroller();
grid.scrollByDeltaY(1)