Is TableTools compatible with XHTML ?
Is TableTools compatible with XHTML ?
andrews812
Posts: 4Questions: 0Answers: 0
Hello, all!
I suppose that TableTools is NOT compatible with XHTML.
In details:
I'm trying to integrate DataTables (1.9.4) and TableTools (2.1.4, as part of DataTables archive) into my XHTML web-portal.
Web-server returns content as "application/xhtml+xml". I'm doing trivial TableTools initialization:
[code]
$(document).ready(function() {
var oTable = $('#table1').dataTable( {
"bProcessing": true,
"sAjaxSource": "/cgi-bin/inventory?command=operators&format=json",
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "/DataTables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
},
"iDisplayLength": 25,
"oLanguage": {
"sUrl": "/locale/ru_RU.KOI8-R/DataTables.json"
}
} );
} );
[/code]
It results in JavaScript exception(s):
[quote]
uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://x.x.x.x/DataTables/extras/TableTools/media/js/ZeroClipboard.js :: anonymous :: line 134" data: no]
Line 0
[/quote]
One exeption per one button. And, as follows, all buttons except "Print" are not working. Browser don't try to load Flash-applet ever. All works fine if content returned as "text/html".
Below is the line 134 of ZeroClipboard.js:
[code]
this.div.innerHTML = this.getHTML( box.width, box.height );
[/code]
I'm not so familiar with XHTML/JavaScript programming, but, AFAIK, there's no innerHTML component in DOM of XHTML standard.
Any ideas?
Thanks!
I suppose that TableTools is NOT compatible with XHTML.
In details:
I'm trying to integrate DataTables (1.9.4) and TableTools (2.1.4, as part of DataTables archive) into my XHTML web-portal.
Web-server returns content as "application/xhtml+xml". I'm doing trivial TableTools initialization:
[code]
$(document).ready(function() {
var oTable = $('#table1').dataTable( {
"bProcessing": true,
"sAjaxSource": "/cgi-bin/inventory?command=operators&format=json",
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "/DataTables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
},
"iDisplayLength": 25,
"oLanguage": {
"sUrl": "/locale/ru_RU.KOI8-R/DataTables.json"
}
} );
} );
[/code]
It results in JavaScript exception(s):
[quote]
uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://x.x.x.x/DataTables/extras/TableTools/media/js/ZeroClipboard.js :: anonymous :: line 134" data: no]
Line 0
[/quote]
One exeption per one button. And, as follows, all buttons except "Print" are not working. Browser don't try to load Flash-applet ever. All works fine if content returned as "text/html".
Below is the line 134 of ZeroClipboard.js:
[code]
this.div.innerHTML = this.getHTML( box.width, box.height );
[/code]
I'm not so familiar with XHTML/JavaScript programming, but, AFAIK, there's no innerHTML component in DOM of XHTML standard.
Any ideas?
Thanks!
This discussion has been closed.
Replies
Correct - but all browsers implement it I think.
I've just tried changing my default TableTools example to use XHTML and it seems to work just fine. So, can you link to a test case showing the issue please ( http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read# ).
Allan
I didn't find how to get JS Bin to load html-document from remote server. So i've placed two test pages entirely remotely. They are almost identical, but:
http://www.amplilogic.com/table.php - has XHTML doctype and returned with "text/html" content-type
http://www.amplilogic.com/table2.php - has XHTML doctype and returned with "application/xhtml+xml" content-type
The first works very well, the second throws javascript exceptions.
The fix is to replace:
> this.div.innerHTML = this.getHTML( box.width, box.height )
with:
[code]
this.div.innerHTML = this.getHTML( box.width, box.height ).replace(/&/g, '&');
[/code]
The commit for this is here: https://github.com/DataTables/TableTools/commit/e7e81c1
Allan
I have two subsequent questions:
1. When i click "Excel" button, browser opens save-file dialog and offers to save file with .csv extension. Well, i change .csv to .xls and then try to open file in OpenOffice (3.2.1). Although the file has .xls extension, OpenOffice seems treat it as .csv and opens import text dialog. Is it bug or feature?
2. Should data be encoded in Unicode to generate xls/pdf files with correct non-latin characters displaying?
2. XLS export is UTF16-LE encoded and CVS UTF-8. The PDF export however doesn't support UTF-8 or 16. That's a limitation of the AlivePDF library unfortunately and I've never found a way around it. I've been looking for an alternative library, but the only real option I've found thus far is about 600K in size, which makes it not really an option!
Allan
After some tests i found that "Print" button also doesn't work correctly for "application/xhtml+xml" content:
- it does not "expand out" table leaving only previously displayed items
- splash screen does not appear after clicking the button
- browser does not return to main screen after pressing escape
the test cases above shows the issue.
After pressing "Print" i see javascript error in console:
[quote]
nParent is null
var nChildren = nParent.childNodes;
TableTools.js (line 1970)
[/quote]
Allan