olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.76k stars 821 forks source link

Question: getting Reference Error on Tabulator 4.2 #1877

Closed dasoares8 closed 5 years ago

dasoares8 commented 5 years ago

Hi likely a dumb q as I am new to js but when I try to run the 4.2 quickstart I get the following:

.../tabulatorExample/node_modules/tabulator-tables/dist/js/tabulator.js:7246 if (element instanceof HTMLElement) { ^

ReferenceError: HTMLElement is not defined at Tabulator.initializeElement (.../tabulatorExample/node_modules/tabulator-tables/dist/js/tabulator.js:7246:26) at new Tabulator (.../tabulatorExample/node_modules/tabulator-tables/dist/js/tabulator.js:6773:8) at Server. (.../tabulatorExample/tab.js:33:14) at Server.emit (events.js:189:13) at parserOnIncoming (_http_server.js:676:12) at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)

Any help would be greatly appreciated. Thanks.

olifolkerd commented 5 years ago

Hey @dasoares8

Thanks for getting in touch,

Which browser are you using?

Cheers

Oli :)

dasoares8 commented 5 years ago

Hi Oli, thanks for responding. It is my work computer, I was using Firefox, probably latest version. David

On Friday, March 8, 2019, 2:28:34 AM EST, Oli Folkerd <notifications@github.com> wrote:  

Hey @dasoares8

Thanks for getting in touch,

Which browser are you using?

Cheers

Oli :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

iAmVaeVictus commented 5 years ago

@olifolkerd - Was there a solution to this? Experiencing the same thing with Tabulator, node.js, express, handlebars.

Tabulator reports v4.2.5

index.js

var Tabulator = require('tabulator-tables');
var sampleData= [
        {id:1, name:"Oli Bob"},
        {id:2, name:"Mary May"},
];

var table = new Tabulator('#example-table", {
  bla bla bla copied from the sample code

table.setData(sampleData);

package.json contains:

{"name": "01-phati-express-dev",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "chopped-and-viewed": "^1.0.0",
    "cookie-parser": "~1.4.3",
    "debug": "~2.6.9",
    "express": "~4.16.0",
    "express-handlebars": "^3.0.2",
    "fast-csv": "^2.4.1",
    "fs": "0.0.1-security",
    "http-errors": "~1.6.2",
    "morgan": "~1.9.0",
    "os": "^0.1.1",
    "path": "^0.12.7",
    "string": "^3.3.3",
    "tabulator-tables": "^4.2.5",
    "url": "^0.11.0",
    "util": "^0.11.1"
  }}

index.hbs <div id="example-table"></div>

Error is at the "new" statement.

Stack:

./tabulator-tables/dist/js/tabulator.js:7257
        if (element instanceof HTMLElement) {
                               ^
ReferenceError: HTMLElement is not defined
    at Tabulator.initializeElement (../tabulator-tables/dist/js/tabulator.js:7257:26)
    at new Tabulator (../tabulator-tables/dist/js/tabulator.js:6782:8)
    at Object.<anonymous> (./routes/index.js:28:17)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
olifolkerd commented 5 years ago

Hey @iAmVaeVictus that does seem to be an issue linked to use in a node environment where the HTMLElement is not defined.

I have pushed a fix to the master branch for this is and will include it in the next patch release.

Cheers

Oli :)

iAmVaeVictus commented 5 years ago

Great Oli!

Is that something I can test? Without it, I'm stuck at the moment.

On Mon, Apr 22, 2019 at 5:55 AM Oli Folkerd notifications@github.com wrote:

Hey @iAmVaeVictus https://github.com/iAmVaeVictus that does seem to be an issue linked to use in a node environment where the HTMLElement is not defined.

I have pushed a fix to the master branch for this is and will include it in the next patch release.

Cheers

Oli :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/olifolkerd/tabulator/issues/1877#issuecomment-485391074, or mute the thread https://github.com/notifications/unsubscribe-auth/ABWBFHQ6U2SU5JO237DKEOLPRWKRPANCNFSM4G4REMDQ .

--

Scott M Portis Owner, Moe's Southwest Grill | www.Moes.com 10 Locations in Middle TN 615-300-3696 (c)

iAmVaeVictus commented 5 years ago

Never mind, I did download the fix and will test using it. Will report any errors.

iAmVaeVictus commented 5 years ago

@olifolkerd - not getting the HTML error now, but the table is not rendering at all. Another user posted a similar issue on Stackoverflow.

I've tried every trick I know. Since there was no response on the stackoverflow (SOF) question, (he switched to vue), I thought I'd let you know. I followed the same usage that Joshua did in his post, and tried other ways too (jQuery/Ajax the old way, defined it in the index.js file, then in the index.handlebars file, etc) - I just get nothing. I thought it had something to do with how the precompiler handles handlebars/jade (he was using jade, I - handlebars)?

If node/express/jade/handlebars is a low priority, I'll just switch to vue, time to learn something new anyway!

rumblersull commented 2 years ago

Hi, have the same issue as in this old thread? Any solutions? Getting a document not defined error using tabulator in index.js with hbs file.