how to set selection zone manually with enableBlockSelection

Hi.

I’m using enableBlockSelection. I want to set value directly to make a selection zone.
I have seen the following API, but I don’t know how to set instance or value to grid._selectionArea.
grid._selectionArea
grid._selectionArea.LeftTopRow
grid._selectionArea.LeftTopCol
grid._selectionArea.RightBottomRow
grid._selectionArea.RightBottomCol

Is there any sample for this?

Thank you.

You may try to use the following API:
topr=mygrid.getSelectedBlock().LeftTopRow
botr=mygrid.getSelectedBlock().RightBottomRow
lcol=mygrid.getSelectedBlock().LeftTopCol
rcol=mygrid.getSelectedBlock().RightBottomCol

For example, please, try to use the following sample:
dhtmlx.com/docs/products/dht … ction.html
with the modified onKeyPressed function:

function onKeyPressed(code,ctrl,shift){ if(code==67&&ctrl){ if (!mygrid._selectionArea) return alert("You need to select a block area in grid first"); mygrid.setCSVDelimiter("\t") mygrid.copyBlockToClipboard() mygrid.clearSelection() } if(code==86&&ctrl){ mygrid.setCSVDelimiter("\t") mygrid.pasteBlockFromClipboard() } if(code==88&&ctrl){ if (!mygrid._selectionArea) return alert("You need to select a block area in grid first"); mygrid.setCSVDelimiter("\t") mygrid.copyBlockToClipboard() topr=mygrid.getSelectedBlock().LeftTopRow botr=mygrid.getSelectedBlock().RightBottomRow lcol=mygrid.getSelectedBlock().LeftTopCol rcol=mygrid.getSelectedBlock().RightBottomCol var i,j for (i=topr;i<=botr;i++){ for (j=lcol;j<=rcol;j++){ mygrid.cells2(i,j).setValue("") } } } return true; }

Thanks for your reply.

What I want to do is “set the values” instead of getting the values of selection zone.
I have tried something like this to make 3 cells (column 9 of row 0 and 2) to be selected, but not working…

mygrid.getSelectedBlock().LeftTopRow = 0;
mygrid.getSelectedBlock().RightBottomRow = 2;
mygrid.getSelectedBlock().LeftTopCol = 9;
mygrid.getSelectedBlock().RightBottomCol = 9;

Any idea?

Unfortunately it’s not available select the block with the API.
Block can be created by the user manually only.