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

TableFilter constructor breaks when "id" parameter contains a period #798

Open
ghost opened this issue Jan 1, 2021 · 1 comment
Open
Labels

Comments

@ghost
Copy link

ghost commented Jan 1, 2021

Describe the bug
When the string id parameter is used in the TableFilter constructor and that id string contains a period, the column filters do not contain any values from the corresponding column.

Reproduction steps:
Steps to reproduce the behavior:

  1. Create a table with an id that has a period
  2. Call the TableFilter constructor with a string of that id

See these contrasting examples:
https://codepen.io/gerrycampion/pen/NWRyQxY

Expected behavior
The column filters should still be populated with the column values even when the table id contains a period.

Observed behavior:
The column filters do not contain any values from the corresponding column.

TableFilter version: 0.7.3
Browser and version: Google Chrome Version 87.0.4280.88 (Official Build) (64-bit)
OS and version: Microsoft Windows 10 Pro x64 Version 10.0.19041 Build 19041
Device: PC

  • Problem started happening recently, didn't happen in an older version of TableFilter: N/A - I just started using TableFilter
  • Problem can be reliably reproduced, doesn't happen randomly: Yes
@ghost ghost added the bug label Jan 1, 2021
@koalyptus
Copy link
Owner

koalyptus commented Jan 2, 2021

Hi @gerrycampion,

Many thanks for reporting this bug, if you need a quick workaround while waiting for the fix, based on the 2nd table in your codepen, replace the configuration with this

var tf1 = new TableFilter("broken.table", {
  col_0: "checklist",
  col_1: "multiple",
  col_2: "select"
})
tf1.id = "broken\\.table"
tf1.init();

The id needs to be escaped... the culprit being a slack querySelectorAll usage here:

return doc.querySelectorAll(`table#${this.id} > tbody > tr`);

Cheers

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

No branches or pull requests

1 participant