MCPcopy
hub / github.com/nadbm/react-datasheet / clearSelectedCells

Function clearSelectedCells

src/DataSheet.js:311–329  ·  view source on GitHub ↗
(start, end)

Source from the content-addressed store, hash-verified

309 }
310
311 clearSelectedCells (start, end) {
312 const {data, onCellsChanged, onChange} = this.props
313 const cells = this.getSelectedCells(data, start, end)
314 .filter(cell => !cell.cell.readOnly)
315 .map(cell => ({...cell, value: ''}))
316 if (onCellsChanged) {
317 onCellsChanged(cells)
318 this.onRevert()
319 } else if (onChange) {
320 // ugly solution brought to you by https://reactjs.org/docs/react-component.html#setstate
321 // setState in a loop is unreliable
322 setTimeout(() => {
323 cells.forEach(({cell, row, col, value}) => {
324 onChange(cell, row, col, value)
325 })
326 this.onRevert()
327 }, 0)
328 }
329 }
330
331 handleNavigate (e, offsets, jumpRow) {
332 if (offsets && (offsets.i || offsets.j)) {

Callers

nothing calls this directly

Calls 1

onChangeFunction · 0.85

Tested by

no test coverage detected