react-table-example icon indicating copy to clipboard operation
react-table-example copied to clipboard

OnEdit

Open imbundle opened this issue 5 years ago • 8 comments
trafficstars

How can I access to the selected row after select one row and click onEdit?

imbundle avatar Jul 06 '20 09:07 imbundle

@ImBundle did you ever find a way to do this? I'm also seeing issues with the value returned from onEdit doesnt seem to contain the selected rows.

michaelbdavid avatar Jan 28 '21 22:01 michaelbdavid

well the onEdit is pretty stubbed out (it passes in a dummy function), but the prototype for onEdit in this example shows that it passes the table instance through to the callback, so you can see what's selected by accessing instance.selectedFlatRows.

ggascoigne avatar Jan 28 '21 22:01 ggascoigne

I'll add, that this is more of a random example about how to get typescript working with react-table v7 - it's very limited, intentionally.

ggascoigne avatar Jan 28 '21 22:01 ggascoigne

@ggascoigne hey thanks for the reply. I still must be missing something. Just dumping the returned value from your dummy function im not seeing .selectedFlatRows. See screenshot of console for this.

selectedFlatRowsMissing

michaelbdavid avatar Jan 29 '21 15:01 michaelbdavid

nvm I figured this out. The value returned by the first callback was hidden by the second due to they are both named a :(

Thanks for the help on this Guy!

michaelbdavid avatar Jan 29 '21 17:01 michaelbdavid

I am having the same problem with using onAdd and onEdit and I am not seeing instance.selectedFlatRows in the dump either. Any help would be greatly appreciated.

tacticalCoder avatar Feb 12 '21 18:02 tacticalCoder

Take a look at https://github.com/ggascoigne/react-table-example/commit/7080fba2ffbaa7e6675a4ee723fd85a734853a6e, it should make things clearer. Note that I was in a hurry so all it does is log to the console.

ggascoigne avatar Feb 21 '21 21:02 ggascoigne

Thanks, It helped a lot !

tacticalCoder avatar Feb 24 '21 17:02 tacticalCoder