bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
664 stars 305 forks source link

[Help] renderer, access to statemanager within renderercontext #868

Closed Weny-murat closed 1 year ago

Weny-murat commented 1 year ago

Thanks to the renderercontext, I want to put a delete button on a column and this button will help to delete that row, but I couldn't find the right way. Can you help me?

My first approach renderer: (rendererContext) { return IconButton( onPressed: () { final row = stateManager.getRowByIdx(rendererContext.rowIdx); stateManager.removeRows([row!]); }, icon: Icon( Icons.delete, color: Colors.red.shade400, ), ); }, but as you can guess "the instance member 'stateManager' can't be accesssed in an initializer.

How can I achieve this behaviour ?

muammerakilli commented 1 year ago

you can check this link

https://weblaze.dev/pluto_grid/build/web/#feature/cell-renderer

Weny-murat commented 1 year ago

Thank you Muammer. I had looked at the demos, but I guess I didn't pay attention to the details.