Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection plugin not working after update #1432

Open
danielwlogan opened this issue Mar 4, 2024 · 5 comments
Open

Selection plugin not working after update #1432

danielwlogan opened this issue Mar 4, 2024 · 5 comments

Comments

@danielwlogan
Copy link

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: 'john@example.com' },
        { name: 'Mark', email: 'mark@gmail.com' },
        { name: 'Eoin', email: 'eo3n@yahoo.com' },
        { name: 'Nisen', email: 'nis900@gmail.com' }
      ]
    }).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
Copy link
Author

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

@nezetic
Copy link

nezetic commented Mar 7, 2024

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({

@vladgabor13
Copy link

any updates?

@JorgenEngenNapstad
Copy link

Hi. Any updates on this?

@IzerkT
Copy link

IzerkT commented May 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants