Closed vikrametc closed 6 years ago
hello @vikrametc ...
Ctrl-C should work (Command-C on mac). Or are you saying you want to do the copy programmatically?
Jonathan
Hi Jonathan,
Basically I need to know what column user has selected and what is the ID for the row which user has selected and copied.
How can I do?
grid.selectionModel.selections[0].firstSelectedCell.x // left grid column index
grid.selectionModel.selections[0].firstSelectedCell.y // top data row index
grid.selectionModel.selections[0].lastSelectedCell.x // right grid column index
grid.selectionModel.selections[0].lastSelectedCell.y // bottom data row index
Following also works:
grid.selectionModel.selections[0].left // left grid column index
grid.selectionModel.selections[0].top // top data row index
grid.selectionModel.selections[0].right // right grid column index
grid.selectionModel.selections[0].bottom // bottom data row index
Thank you Jonathan, left, right, top, bottom worked.
Vikram
One more thing should I listen for key-down event for selection or is there any other event I can listen for the grid cells selection?
@vikrametc just saw your one more thing:
myGrid.addEventListenter('fin-selection-changed', function(event) {
event.detail.selections[0].left // etc.
});
Hi Jonathan,
Thank you for your response, now since I got the left, right, top and bottom value, using this how can I get the cell value?
I am doing somehting like this this.grid.getGridCellFromMousePoint(event.detail.mouse).cellEvent; but this doesn't give me the actual cell.
Is there any other way?
please tell me the use case: what is the actual goal? i thought you were cutting & pasting to excel AND that you wanted to know the source coordinates.... just to be clear, cutting & pasting is already fully supported.
So I have a use case which is basically when user do a selection and doing copy pasting in other blotter(not excel), I need to get the data for those selection and show the updated blotter. To do this, I need to know the columns Name of the selection and the dataRow for the selection. Using left, right, top, bottom value how can I get the column header names and the respective dataRow?
Thank you
Copy (ctrl-C or command-C) puts the currently selected values in the copy buffer, tab-separated by column and newline-separated by row.
But even without user interaction (typing ctrl-C), the selected cells are available to you. For example, in the demo, I select a region:
In the console:
grid.getSelection()[0]
yields:
{
last_name: ["Barbarosa", "Oneil", "DePena", "Gotti"],
birthTime: [480, 620, 1316, 62]
}
or:
grid.getSelectionMatrix()[0]
yields:
[
["Barbarosa", "Oneil", "DePena", "Gotti"],
[480, 620, 1316, 62]
]
Hope this helps. Jonathan
Thank you Jonathan, This is exactly what I wanted to know. Thanks for your help. Can you provide the documentation URL where I can see the info about using grid.
Thanks, Vikram
Hypergrid documentation is a work-in-progress. We definitely could use some help in this area! Hopefully after release of v3.0.0 I can put some time into it.
The documentation currently consists of:
getRowSelection
and getRowSelectionMatrix
) The two methods do appear in the
Hi Team,
I have a requirement to copy part of the grid using arrow keys and paste the selected grid cell in xls, how can I do this?
I have attached the key-down event and able to trace user selection but how to get the value of those selected cells in Ctrl+C? Please help me