bvaughn / react-virtualized

React components for efficiently rendering large lists and tabular data
http://bvaughn.github.io/react-virtualized/
MIT License
26.1k stars 3.05k forks source link

How using checkbox in react-virtualized? #1811

Closed allcho closed 1 year ago

allcho commented 1 year ago

Hello, How using checkbox in react-virtualized?

I try using Ref, but it's bad way, because ref set to input only what I see in window

const cellRenderer = (cell: any) => {
  if(cell.dataKey.includes('input')){  

    return (
      <>
          <input 
            type='checkbox' 
            id={`${cell.rowData.id}`} 
            ref={ref => (cellProps.checkBox.checkboxRef.current[cell.rowData.id] = ref)}
            onChange={cellProps.checkBox.onChange}
            checked={cellProps.checkBox.checked.includes(`${cell.rowData.id}`)}
          /> 
      </>
    );
  }