gridjs
gridjs copied to clipboard
Receive `cell.data` on plugin
Describe the bug
When using plugin
as cell, the cell.data
receive null
Expected behavior
When using plugin
, the props should receive similar value with formatter cell
To Reproduce Steps to reproduce the behavior:
- Check the codesandbox
- Open the console
- See
this.props.cell.data
is null
Screenshots
Additional context
gridjs-svelte
use plugin for rendering Svelte component in the cell
any workaround for this?
It looks like there is a bug where an additional null
value is inserted at the position of the column with a plugin. If there are additional columns after the one with a plugin, their values are all offset by one position.
If you look at https://svelte.dev/repl/0c77bee765c1458d825a4df13aefb5a4?version=3.46.6, you will see that the plugin accesses the cell at index 3, even if it should access the one at index 2 (which is indeed null
).
It seems that the code does not expect the data to contain a value at all for the column with a plugin. A possible workaround is to add an additional column with hidden: true
with the data and use that in the plugin by getting the data via row.cell(hiddenColumnIndex).data
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
+1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi there, I think problem comes from you not set data prop in column.
I just add data: (row) => row
and in component return email from data {cell.data.email}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.