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

Could not instantiate TableFilter #799

Open
meghan2733 opened this issue Jan 31, 2021 · 1 comment
Open

Could not instantiate TableFilter #799

meghan2733 opened this issue Jan 31, 2021 · 1 comment

Comments

@meghan2733
Copy link

Hello, I'm trying to run Pop-up table filter locally. I get error:

Uncaught Error: Could not instantiate TableFilter: HTML table
DOM element not found.
at new TableFilter (tablefilter.js:1)
at tablefilter.html:7

Code below. I don't know what I'm missing. Could be something really stupid. Any help will be highly appreciated.

<script src="./tablefilter/tablefilter.js"></script>	
<script type="text/javascript">	

var tf = new TableFilter('demo', 1, {
base_path: 'tablefilter/',
col_1: 'select',
col_2: 'checklist',
col_3: 'select',
popup_filters: true,
auto_filter: {
delay: 1100 //milliseconds
},
alternate_rows: true,
rows_counter: true,
btn_reset: true,
loader: true,
mark_active_columns: true,
highlight_keywords: true,
no_results_message: true,
col_types: [
'string', 'string', 'number',
'number', 'number', 'number',
'number', 'number', 'number'
],
col_widths: [
'150px', '100px', '100px',
'70px', '100px', '70px',
'70px', '60px', '60px'
],
extensions: [{
name: 'sort',
images_path: 'https://unpkg.com/tablefilter@latest/dist/tablefilter/style/themes/'
}]
});
tf.init();

</script>

TableFilter starter

country isocode year POP XRAT PPP cgdp cc ci
Benin BEN 1998 5950.33 589.9517822 190.95 1178.46 90.98 7.55
Benin BEN 1999 6109.53 615.6990967 200.19 1174.90 92.61 7.86
Benin BEN 2000 6272.00 711.9763184 200.61 1224.74 92.27 8.25
Burkina Faso BFA 1994 9755.03 555.2047119 125.76 838.76 79.81 6.57
Burkina Faso BFA 1995 9988.00 499.148407 136.65 860.89 80.41 9.29
Burkina Faso BFA 1996 10225.00 511.5523987 144.18 881.11 80.40 12.12
Burkina Faso BFA 1997 10473.53 583.6693726 141.78 899.01 76.94 14.94
Russia RUS 1998 146899.01 9.705082893 2.64 7086.39 67.73 9.20
Russia RUS 1999 146308.99 24.6199398 4.03 8074.70 57.35 8.81
Russia RUS 2000 145555.01 28.12916946 4.85 9995.91 54.74 8.79
Rwanda RWA 1994 6230.00 194.517 50.39 529.48 132.16 4.48
Rwanda RWA 1995 6400.00 262.1975098 70.67 746.34 92.77 3.08
Rwanda RWA 1996 6727.00 306.8200073 77.90 823.25 89.71 3.21
Rwanda RWA 1997 7895.18 301.5297852 84.13 847.79 91.44 3.72
Rwanda RWA 1998 8105.00 312.3140869 85.32 914.22 89.34 4.22
El Salvador SLV 1995 5669.00 8.754583359 3.54 4143.59 89.31 10.35
El Salvador SLV 1996 5798.00 8.755000114 3.69 4235.79 88.77 7.79
El Salvador SLV 1997 5911.00 8.756250381 3.74 4408.41 87.05 7.90
Slovak Republic SVK 2000 5401.00 46.0352 13.02 12618.53 52.22 24.78
Slovenia SVN 1994 1988.90 128.8085938 79.97 11662.12 53.21 19.87
Slovenia SVN 1995 1990.00 118.5185013 89.03 12574.96 54.46 23.11
Slovenia SVN 1996 1991.00 135.3643036 97.27 13151.51 54.32 23.23
Slovenia SVN 1997 1985.96 159.6882935 103.96 14143.02 53.24 24.14
Slovenia SVN 1998 1982.60 166.134201 108.93 15067.34 52.82 25.35
Zambia ZMB 1994 8740.72 669.3706055 307.48 834.19 75.43 9.86
Zambia ZMB 1995 8980.00 864.1192017 402.40 829.37 76.55 10.31
Zambia ZMB 1996 9214.40 1207.900024 515.01 838.05 78.74 10.99
Zambia ZMB 1997 9443.21 1314.498047 596.97 851.47 77.59 12.15
Zambia ZMB 1998 9665.71 1862.06897 744.91 800.69 85.12 13.75
Zambia ZMB 1999 9881.21 2388.019043 941.87 765.24 91.82 15.30
Zambia ZMB 2000 10089.00 3110.843994 1157.63 840.97 86.33 15.38
Zimbabwe ZWE 1994 10775.35 8.151538849 2.01 2586.84 60.10 18.53
Zimbabwe ZWE 1995 11011.00 8.66537571 2.15 2603.37 66.89 15.03
Zimbabwe ZWE 1996 11242.16 10.00234985 2.64 2860.23 72.06 11.32
Zimbabwe ZWE 1997 11923.52 12.11128998 3.17 2727.06 82.82 11.01
Zimbabwe ZWE 1998 12153.85 23.67910957 4.06 2799.85 77.66 10.75
Zimbabwe ZWE 1999 12388.32 38.30120087 6.12 2770.48 76.89 10.73
Zimbabwe ZWE 2000 12627.00 44.41791916 9.48 2607.03 69.23 8.62
@rimace
Copy link

rimace commented Apr 1, 2021

The ID of your table is user-content-demo , but in your Javascript you try to find a DOM element with an ID demo

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

2 participants