Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

Cannot set property 'width' of undefined #35

Closed
lynx12345 opened this issue Jan 20, 2020 · 2 comments
Closed

Cannot set property 'width' of undefined #35

lynx12345 opened this issue Jan 20, 2020 · 2 comments

Comments

@lynx12345
Copy link

Hi!

I'm implemted succesfully an app with table to excel export, with this approach:

TableToExcel.convert(document.getElementById("table_SP_HOME_VER_PARTE_LOGIS_227"));

in the attach file, that line works fine with table2.html, but when I want to implement a new table (table1.html) it fails with this error:

TableToExcel.convert(document.getElementById("table_SP_GRD_RENDICION_228"))
tableToExcel.js:2 Uncaught TypeError: Cannot set property 'width' of undefined
    at tableToExcel.js:2
    at Array.forEach (<anonymous>)
    at Object.parseDomToTable (tableToExcel.js:2)
    at Object.tableToSheet (tableToExcel.js:508)
    at Object.tableToBook (tableToExcel.js:508)
    at Object.convert (tableToExcel.js:508)
    at <anonymous>:1:14

I don't understand why...

thnks in advance!

examples.zip

@rohithb
Copy link
Member

rohithb commented Jan 21, 2020

This is because, you defined width for 7 columns (data-cols-width="20,20,15,20,15,15,15") , while your table only contains 4. Just update data-cols-width="20,20,15,20" then it will work.
refer #13 also.
I will add a fix for this too as @aswinsreenath in #10 .

@lynx12345
Copy link
Author

OK! thnks...

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

No branches or pull requests

2 participants