react-datasheet-grid icon indicating copy to clipboard operation
react-datasheet-grid copied to clipboard

onBlur firing twice if `autoAddRow = true` on DynamicDataSheetGrid

Open ajboni opened this issue 3 years ago • 2 comments
trafficstars

If autoAddRow = true and you are on the last row, once you press enter to confirm edit and auto-create new row, the onblur callback is called twice.

 <DynamicDataSheetGrid
        ref={gridRef}
        value={data}
        onChange={setData}
        onBlur={() => {
          console.log("blur");
        }}
        columns={columnsMemo}
        autoAddRow
/>

If I instead use <DataSheetGrid/> the issue does not occurs.

ajboni avatar Apr 06 '22 01:04 ajboni

Hey @ajboni, thx for the repport, I will have a look into it

nick-keller avatar Apr 13 '22 08:04 nick-keller

Related to #230. Looks like the way onBlur is implemented is not based on cells' or elements' onBlur events but via useEffect in such a way that any table change will also trigger the provided onBlur function.

Thanks @nick-keller for looking into this!

larissa-n avatar Feb 17 '23 12:02 larissa-n