Hi Team,
I need to export grid as well as hierarchical grid to excel/pdf.
I am using the below code:
function exportToExcel() { $.ig.GridExcelExporter.export($("#gridCategory"), {
dataExportMode: $("#dataExportMode").val() });
The export functionality is not working and is giving the error:
I am using the version: 13.2.20132.1010 (as mentioned in infragistics.core.js file)
Hi,
this looks fine, but please make sure that all IgniteUI resources you are loading are the same version.
When the page loads open the developer tools (F12) and go to the Resources tab - please make sure you are seeing all needed resources:
infragistics.core.jsinfragistics.lob.js
infragistics.documents.core.jsinfragistics.excel.js")infragistics.gridexcelexporter.js
Also, you can just copy the <head> part of the rendered html so that I can see which resources are loaded. You can also copy the part where you try to export the grid and I think this will be enough.
P.S. When you load .corre.js and .lob.js then you don't need the infragistics.loader.js. The loader is used to download the resources you need on demand, which boosts performance, but this way they are already downloaded via the core.js and lob.js files.
Hi Hristo,
I receive this error while loading the View.
Also, I have specified bundles in BundleConfig.cs file as mentioned below:
public static void RegisterBundles(BundleCollection bundles) { // styles bundles var core = new StyleBundle("~/assets/bundles/css") .Include("~/Assets/css/main.css") .Include("~/Assets/css/site.css") .Include("~/Assets/css/spinner.css") .Include("~/Assets/css/infragistics.theme.custom.css") .Include("~/Assets/css/infragistics.css") .Include("~/Assets/css/infragistics.structure.css") .Include("~/Assets/css/fonts.css")/*Fonts*/ .Include("~/Assets/css/custom.css");
core.Transforms.Add(new CssMinify()); bundles.Add(core);
// java scripts bundles var coreJs = new ScriptBundle("~/bundles/js") .Include("~/Assets/js/jquery/jquery-2.0.3.js") .Include("~/Assets/js/jquery/jquery-ui-1.10.3.js") .Include("~/Assets/js/plugins/jquery.cookie.js") .Include("~/Assets/js/modernizr-2.6.2.js") .Include("~/Assets/js/main.js") .Include("~/Assets/js/custom.js") .Include("~/Assets/js/plugins.js") .Include("~/Assets/js/plugins/transition.js") .Include("~/Assets/js/plugins/tab.js") .Include("~/Assets/js/infragistics.core.js") .Include("~/Assets/js/infragistics.lob.js") .Include("~/Assets/js/infragistics.loader.js") .Include("~/Assets/js/filesaver.js") .Include("~/Assets/js/blob.js") .Include("~/Assets/js/jquery/jquery.ui-contextmenu.js") .Include("~/Assets/js/modules/infragistics.documents.core.js") .Include("~/Assets/js/modules/infragistics.excel.js") .Include("~/Assets/js/modules/infragistics.gridexcelexporter.js") ; coreJs.Transforms.Add(new JsMinify()); bundles.Add(coreJs); }
I am building the grid in the controller using GridModel and in the view I just have this code:
@model Infragistics.Web.Mvc.GridModel
@Html.Infragistics().Grid(Model)
Please let me know if you need any further details.
-Regards,
Agraj
I am not able to assume what the issue is this way. It will be helpful if you provide the code of your view page so that I can assure you have properly loaded all the resources. Please noe that you also need the FileSaver and Blob libraries in order for the exported sheet to be saved locally:
<!-- External files for exporting --> <script src="http://www.igniteui.com/js/external/FileSaver.js"></script> <script src="http://www.igniteui.com/js/external/Blob.js"></script>
Also, please specify if the error you receive is displayed while loading or on certain action (like exporting). Looking forward to hearing from you.
Thanks Hristo for your response.
I switched to 15.2.20152.1027 version, now when I run the application, the data inside the is not being displayed (only header is displayed). Not sure if I am doing something wrong. In the Chrome console window, it says: "Cannot read property 'key' of undefined - infragistics.lob.js.
I replaced the MVC dll and the below Javascript files:
-infragistics.core.js
-infragistics.lob.js
-infragistics.loader.js
-infragistics.documents-core.js
-infragistics.excel.js
-infragistics.gridexcelexporter.js
Please assist. Thank you.
Hi Agraj,
The igGridExcelExporter has been introduced with 15.1 volume of IgniteUI initially supporting igGrid export. With 15.2 the support of igTreeGrid and igHierarchicalGrid was introduced. In order to use it you need to upgrade your application to 15.1 or later. If you stay with the 13.2 volume you can export the igGrid using the ASP.NET MVC Excel library as shown in http://www.igniteui.com/infragistics-excel/overview
If you are going to upgrade your application I suggest that you start with the samples here:
https://www.igniteui.com/grid/export-basic-grid
and with the help topic here:
https://www.igniteui.com/help/iggridexcelexporter-overview
Please let me know if you have further questions on the matter.