gridjs icon indicating copy to clipboard operation
gridjs copied to clipboard

Receive `cell.data` on plugin

Open iamyuu opened this issue 3 years ago • 6 comments

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:

  1. Check the codesandbox
  2. Open the console
  3. See this.props.cell.data is null

Screenshots props log

Additional context gridjs-svelte use plugin for rendering Svelte component in the cell

iamyuu avatar Jan 16 '22 02:01 iamyuu

any workaround for this?

carlos-dubon avatar Mar 08 '22 20:03 carlos-dubon

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).

GaretJax avatar Apr 04 '22 07:04 GaretJax

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.

GaretJax avatar Apr 04 '22 07:04 GaretJax

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.

stale[bot] avatar Jun 04 '22 01:06 stale[bot]

+1

GaretJax avatar Jun 04 '22 07:06 GaretJax

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.

stale[bot] avatar Aug 12 '22 01:08 stale[bot]

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}

image image

luandnh avatar Nov 06 '22 15:11 luandnh

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.

stale[bot] avatar Jan 07 '23 15:01 stale[bot]