Get help with using Metro 4 components
-
brunogz
- Posts: 13
- Joined: Wed Oct 10, 2018 11:20 pm
-
Status:
Offline
Post
by brunogz » Thu Oct 11, 2018 2:18 pm
I'm trying to export the data from a table, but I'm getting the following error:
Unable to get property 'export' of undefined or null reference
Code: Select all
function exportaTabela() {
var table = $("#tblBusca").data('table');
table.export('CSV', 'all', 'table-export.csv', {
csvDelimiter: "\t",
csvNewLine: "\r\n",
includeHeader: true
});
#tblBusca is the id of the table I want to export.
Thanks.
-
olton
- Site Admin
- Posts: 170
- Joined: Mon Apr 09, 2018 6:19 pm
- Location: Kiev, Ukraine
-
Status:
Offline
Post
by olton » Thu Oct 11, 2018 2:32 pm
Check metro4 version for latest
-
brunogz
- Posts: 13
- Joined: Wed Oct 10, 2018 11:20 pm
-
Status:
Offline
Post
by brunogz » Thu Oct 11, 2018 3:00 pm
-
olton
- Site Admin
- Posts: 170
- Joined: Mon Apr 09, 2018 6:19 pm
- Location: Kiev, Ukraine
-
Status:
Offline
Post
by olton » Thu Oct 11, 2018 4:52 pm
Check your metro4 version. Must be 4.2.24
-
brunogz
- Posts: 13
- Joined: Wed Oct 10, 2018 11:20 pm
-
Status:
Offline
Post
by brunogz » Thu Oct 11, 2018 11:47 pm
Thank you very much for your attention.
Is my code correct? The version is right.
/*
* Metro 4 Components Library v4.2.24 build 702 (
https://metroui.org.ua)
* Copyright 2018 Sergey Pimenov
* Licensed under MIT
*/
-
olton
- Site Admin
- Posts: 170
- Joined: Mon Apr 09, 2018 6:19 pm
- Location: Kiev, Ukraine
-
Status:
Offline
Post
by olton » Fri Oct 12, 2018 12:09 am
Show your code where table is defined. Check, if table have role "table" with attribute "data-role".
To export any table without role "table", you must use object Metro.export.
Code: Select all
<table id="myTable">...<table>
...
var export = Metro.export.tableToCSV;
export($('#myTable'), "export.csv", {
csvDelimiter: "\t",
csvNewLine: "\r\n",
includeHeader: true
})