You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to read cell values from a selection?
I made a simple code to do just that, but I am wondering if there is a built in method. Maybe I missed something in the docs?
.....const[data,setData]=React.useState<Row[]>([{firstName: 'Elon',lastName: 'Musk',custom: ""},{firstName: 'Jeff',lastName: 'Bezos',custom: ""},{firstName: "",lastName: "",custom: ""},])constgetSelectionValues=(selection)=>{//If no selection, returnif(!selection['selection'])returnconstcolId=selection['selection'].min.colId;conststartRow=selection['selection'].min.row;constendRow=selection['selection'].max.row;//Get the values from the stateletvalues=[];data.forEach((row,idx)=>{if(idx>=startRow&&idx<=endRow){values.push(row[colId]);}});console.log(values);};return(<DataSheetGridvalue={data}onChange={setData}columns={columns}onSelectionChange={getSelectionValues}/>).....
I know current methods onSelectionChange and selection return ({ selection: { min: Cell, max: Cell } | null }) => void
Would be nice if {value: 'Elon'} was included in the object. I can take a look at the code and submit a PR
Is there a way to read cell values from a selection?
I made a simple code to do just that, but I am wondering if there is a built in method. Maybe I missed something in the docs?
I know current methods
onSelectionChange
andselection
return({ selection: { min: Cell, max: Cell } | null }) => void
Would be nice if
{value: 'Elon'}
was included in the object. I can take a look at the code and submit a PRDoc reference:
https://react-datasheet-grid.netlify.app/docs/api-reference/props/#onselectionchange
The text was updated successfully, but these errors were encountered: