how can i manual selected(focus) any cell with event?
i wanto focus some cell when the grid is mounted. i search some issue and try ,like this #552. operate the DOM with js event,,but its not work . so,this coming. my 'lovely' pm want to autofocus anyone cell with logical condition . so,what should I do? thanks guys.
i try this #1151 . it's not work.
Waiting for the solution
Try this: someEvent = event => { const idx = 3; const rowIdx = 3; this.grid.selectCell({ idx, rowIdx }) };
<ReactDataGrid .. ref={grid => this.grid = grid} .. />
Try this: someEvent = event => { const idx = 3; const rowIdx = 3; this.grid.selectCell({ idx, rowIdx }) };
<ReactDataGrid .. ref={grid => this.grid = grid} .. />
thanks god!! it's work. But it should be with event.
eg:
<a
className={'toFocus'}
style={{
position: 'fixed',
left: 20000,
top: 20000,
}}
onClick={() => {
const idx = 1;
const rowIdx = 0;
this.grid.selectCell({idx, rowIdx});
}}
>
U CAN NOT SEE ME
</a>
....
js: whereever u want to focus some cell , just trigger the event
document.getElementsByClassName('toFocus')[0].click();
Try this: someEvent = event => { const idx = 3; const rowIdx = 3; this.grid.selectCell({ idx, rowIdx }) };
<ReactDataGrid .. ref={grid => this.grid = grid} .. />
Thanks! This method works as expected. I'm only wondering why it does not have any single mention in documentation :(
Try this: someEvent = event => { const idx = 3; const rowIdx = 3; this.grid.selectCell({ idx, rowIdx }) };
<ReactDataGrid .. ref={grid => this.grid = grid} .. />
This works for single cell selection.Is there a way to select multiple cells like range of selection from topLeft to bottomRight positions?
documentation leaves much to be desired, ahem