Hi,
I want to add an excel export button on my MVC project. I tried to use the $.ig.GridExcelExporter(); but it give keeps giving me an error.
I added the following javascript libraries on my project:
<script type="text/javascript" src="~/js/modules/infragistics.documents.core_core.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.excel_core.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.gridexcelexporter.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.excel_serialization_openxml.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.ext_core.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.ext_collections.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.ext_collectionsextended.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.ext_io.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.ext_text.js"></script> <script type="text/javascript" src="~/js/modules/infragistics.ext_ui.js"></script>
My code is:
$('#exportBtn').on('click', function() {
$.ig.GridExcelExporter.exportGrid($("#grid"), { fileName: "Sample" });
})
When I run it, it give me following error:
Please help!
Hello Kristine,
Thank you for posting to our community!
I have been looking into your question and, as mentioned in our Grid Excel Exporter Overview topic here, under the Dependencies section:
The igGridExcelExporter is dependent upon the Infragistics JavaScript Excel library, so we need to add references to the library js files and the igGridExcelExporter js file:
<script src="igniteui/js/infragistics.core.js"></script> <script src="igniteui/js/infragistics.lob.js"></script> <script src="igniteui/js/modules/infragistics.ext_core.js"></script> <script src="igniteui/js/modules/infragistics.ext_collections.js"></script> <script src="igniteui/js/modules/infragistics.ext_text.js"></script> <script src="igniteui/js/modules/infragistics.ext_io.js"></script> <script src="igniteui/js/modules/infragistics.ext_ui.js"></script> <script src="igniteui/js/modules/infragistics.documents.core_core.js"></script> <script src="igniteui/js/modules/infragistics.ext_collectionsextended.js"></script> <script src="igniteui/js/modules/infragistics.excel_core.js"></script> <script src="igniteui/js/modules/infragistics.ext_threading.js"></script> <script src="igniteui/js/modules/infragistics.ext_web.js"></script> <script src="igniteui/js/modules/infragistics.xml.js"></script> <script src="igniteui/js/modules/infragistics.documents.core_openxml.js"></script> <script src="igniteui/js/modules/infragistics.excel_serialization_openxml.js"></script> <script src="igniteui/js/modules/infragistics.gridexcelexporter.js"></script>
or using the bundled Infragistics JavaScript Excel file:
<script src="igniteui/js/infragistics.core.js"></script> <script src="igniteui/js/infragistics.lob.js"></script> <script src="igniteui/js/infragistics.excel-bundled.js"></script> <script src="igniteui/js/modules/infragistics.gridexcelexporter.js" type="text/javascript"></script>
I would suggest using the bundled JavaScript Excel file. Here could be found a small sample demonstrating the grid Excel export feature.
Please test it on your side and let me know if you need any further assistance regarding this matter.
Looking forward to your reply.
Sincerely, Riva Ivanova Software Developer