gridjs icon indicating copy to clipboard operation
gridjs copied to clipboard

Selection plugin not working after update

Open danielwlogan opened this issue 1 year ago • 7 comments

Describe the bug After the update (6.2.0), the Selection plugin no longer produces the check boxes. Prior to this update the plugin could be used without installation.

To Reproduce Here is a small section of code that demonstrates the missing check boxes:

`

<script src="https://unpkg.com/gridjs/dist/gridjs.umd.js"></script>
<script src="https://unpkg.com/gridjs/plugins/selection/dist/selection.umd.js"></script>
<script>
    new gridjs.Grid({
        columns: [
        {
          name: 'Details',
          plugin: { component: gridjs.plugins.selection.RowSelection }
        },
        { name: 'Name' },
        { name: 'email' }
      ],
      data: [
        { name: 'John', email: '[email protected]' },
        { name: 'Mark', email: '[email protected]' },
        { name: 'Eoin', email: '[email protected]' },
        { name: 'Nisen', email: '[email protected]' }
      ]
    }).render(document.getElementById("wrapper"));
</script>
`

Expected behavior I would expect a grid with three columns and the left most column to be a series of check boxes

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Microsoft Edge
  • Version: 122.0.2365.52 (Official build) (64-bit)

Additional context The code was working on 2024-03-01

danielwlogan avatar Mar 04 '24 21:03 danielwlogan

Replacing the gridjs call with <script src="https://unpkg.com/[email protected]/dist/gridjs.umd.js"></script> makes the check boxes appear.

danielwlogan avatar Mar 04 '24 22:03 danielwlogan

There's indeed a regression in 6.2.0.

The plugin list is cleared after the header config is parsed.

This patch seems enough to fix the issue.

diff --git a/src/config.ts b/src/config.ts
index 86bdbc6..92adae9 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -149,6 +149,9 @@ export class Config {
       });
     }

+    // clear existing plugins list to prevent duplicate errors
+    config.plugin = new PluginManager();
+
     // Header
     config.assign({
       header: Header.createFromConfig(config),
@@ -167,9 +170,6 @@ export class Config {
       translator: new Translator(config.language),
     });

-    // clear existing plugins list to prevent duplicate errors
-    config.plugin = new PluginManager();
-
     if (config.search) {
       // Search
       config.plugin.add({

nezetic avatar Mar 07 '24 13:03 nezetic

any updates?

vladgabor13 avatar Apr 17 '24 09:04 vladgabor13

Hi. Any updates on this?

JorgenEngenNapstad avatar May 15 '24 16:05 JorgenEngenNapstad

Is there any other way to use selection plugin on Vue? I have same issue.

IzerkT avatar May 26 '24 12:05 IzerkT

https://codepen.io/zoeleee/pen/QWReKVO same issue

ZoeLeee avatar Jul 02 '24 06:07 ZoeLeee

It's ok on ver 6.1.1

ZoeLeee avatar Jul 12 '24 06:07 ZoeLeee