jQuery UI Widgets › Forums › Plugins › Data Adapter › Export Html error
Tagged: Cannot read property 'prototype' of undefined, export, jqxdata.export.js, jqxdata.js, reference, script
This topic contains 6 replies, has 2 voices, and was last updated by Dimitar 8 years, 8 months ago.
-
AuthorExport Html error Posts
-
Hi,
When i try to include the jqxdata.export.js file in my file i get the following error.
Uncaught TypeError: Cannot read property ‘prototype’ of undefined.
In line number 7 of jqxdata.export.js.
Hello Peter,
Could you please provide me a solution in above topic.
Thanks in advance.
Hi Natraj,
Please also make sure you also have a reference to jqxdata.js in your page. Here is a working example with jqxdata.export.js included: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/dataexport.htm?arctic.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hello Dimitar,
Thanks for the response.
I include jqxdata.js in my file. Below is my code.
<!DOCTYPE html>
<html lang=”en”>
<head>
<link rel=”stylesheet” href=”jqwidgets-ver3.9.1/jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”jqwidgets-ver4.0.0/scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxdata.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxdata.export.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.export.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxbuttons.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxscrollbar.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxmenu.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.columnsresize.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.edit.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.selection.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.pager.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxlistbox.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxdropdownlist.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.sort.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxcheckbox.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/demos/jqxgrid/generatedata.js”></script>
<script type=”text/javascript” src=”jqwidgets-ver3.9.1/jqwidgets/jqxgrid.sort.js”></script><script type=”text/javascript”>
$(document).ready(function () {
// prepare the data
var data = generatedata(10);
var source =
{
localdata: data,
datatype: “array”,
datafields:
[
{ name: ‘firstname’, type: ‘string’ },
{ name: ‘lastname’, type: ‘string’ },
{ name: ‘productname’, type: ‘string’ },
{ name: ‘available’, type: ‘bool’ },
{ name: ‘date’, type: ‘date’ },
{ name: ‘quantity’, type: ‘number’ },
{ name: ‘price’, type: ‘number’ }
]
};
var dataAdapter = new $.jqx.dataAdapter(source);
// initialize jqxGrid
$(“#jqxgrid”).jqxGrid(
{
width: 850,
autoheight: true,
source: dataAdapter,
altrows: true,
sortable: true,
selectionmode: ‘multiplecellsextended’,
columns: [
{ text: ‘First Name’, datafield: ‘firstname’, width: 120 },
{ text: ‘Last Name’, datafield: ‘lastname’, width: 120 },
{ text: ‘Product’, datafield: ‘productname’, width: 177 },
{ text: ‘Available’, datafield: ‘available’, columntype: ‘checkbox’, width: 67, cellsalign: ‘center’, align: ‘center’ },
{ text: ‘Ship Date’, datafield: ‘date’, width: 120, align: ‘right’, cellsalign: ‘right’, cellsformat: ‘d’ },
{ text: ‘Quantity’, datafield: ‘quantity’, width: 70, align: ‘right’, cellsalign: ‘right’ },
{ text: ‘Price’, datafield: ‘price’, cellsalign: ‘right’, align: ‘right’, cellsformat: ‘c2’ }
]
});
$(“#print”).jqxButton();$(“#print”).click(function () {
var gridContent = $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’);
var newWindow = window.open(”, ”, ‘width=800, height=500’),
document = newWindow.document.open(),
pageContent =
‘<!DOCTYPE html>\n’ +
‘<html>\n’ +
‘<head>\n’ +
‘<meta charset=”utf-8″ />\n’ +
‘<title>jQWidgets Grid</title>\n’ +
‘</head>\n’ +
‘<body>\n’ + gridContent + ‘\n</body>\n</html>’;
document.write(pageContent);
document.close();
newWindow.print();
});
});</script>
</head>
<body class=’default’>
<div id=’jqxWidget’ style=”font-size: 13px; font-family: Verdana; float: left;”>
<div id=”jqxgrid”></div>
<div style=’margin-top: 20px;’>
<div style=’margin-left: 10px; float: left;’>
<input type=”button” value=”Print” id=’print’ />
</div>
</div>
</div>
</html>Hi Natraj,
It seems you are trying to run our demo Data Printing. Is the issue resolved now that you have included jqxdata.js?
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
Yes i try to run your demo only. After including jqxdata.js also the error comes.
Hi Natraj,
No such error is thrown when running and testing the online demo. Are you sure the paths to your script files are correct? Please also try updating to version 4.0.0 and share if the issue persists.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.