:: Forum >>

Want to move all rows data from one grid to another grid.

I want to move all rows data from one grid to another grid onclick of button,

is there any functinality available for this?

how can i select all rows from grid??
we just have "gridobj.getCellText(text,col,row);" for cell text.

how to get all rows?
APP
Thursday, July 2, 2009
Here's an example Alex posted a while back. Its similar to what you want -
http://www.activewidgets.com/javascript.forum.13420.0/example-move-rows-between-two.html
Anthony
Thursday, July 2, 2009
Yes, as Anthony said, this is the example you must take as reference.
Just need a few adjusts to make it work with "all rows selected".

PLS Note that I removed obj1.deleteRow(a[i]); which is causing interferences for multiple rows selection and replaced with a single obj1.setRowIndices([]); to clear souce grid-rows, but need a few extra lines if you need to completely clean the source grid.

Note2 : does NOT work in opposite direction. Adjust the function toSource() in same way if needed.
function toTarget(){
//var a = obj1.getSelectedRows(); //REMOVED
var a = obj1.getRowIndices(); //NEW

for(i=0; i<a.length; i++){
obj2.addRow(a[i]);
// obj1.deleteRow(a[i]); //REMOVED
}

obj1.setRowIndices([]); //NEW
obj2.setSelectedRows(a.concat());
obj1.setSelectedRows([]);

label.setControlText("Target: " + obj2.getRowIndices());
}
Carlos
Thursday, July 2, 2009
thanks. its working now.
APP
Friday, July 3, 2009

This topic is archived.


Back to support forum

Forum search