gridtogrid

Hi,

I added some values when items are dragged from one Grid to another Grid. It works fine … like so:

mygrid.gridToGrid = function(rowId,sgrid,tgrid){
		var y=[];
		for (var i=0; i<gridOne.getColumnCount(); i++)
		y[i]= gridOne.cells(rowId,i).getValue();
		y.push(treeSelected);
		return y;
}

This is adding an extra cell value to the end for me.

But now I need to fix it up more. I have seven source Grids which may be dragged to the one target Grid. However when I add an “if” statement, then the “push” stops working.

mygrid.gridToGrid = function(rowId,sgrid,tgrid){
	if (sgrid==gridOne) {
		var y=[];
		for (var i=0; i<gridOne.getColumnCount(); i++)
		y[i]= gridOne.cells(rowId,i).getValue();
		y.push(treeSelected);
		return y;
	}
}

Can you guide me to a better way? Thanks!

Probably it appears because of if-statement is false. Check if “grid” is real equeal to “gridOne”

I did check before I asked, with an alert. I can’t think of any possible reason for this not to work. Can you see any syntax error?

I do not see any syntax error. What is “treeSelected”? Where do you define it? Is it defined inside gridToGrid() function?

BTW, you can use FireBug extension for FireFox, place “debugger” inside if-statement and check if it really works.