I'm working on a ASP.NET MVC application where I have a custom made table with data from a list in the model that I pass into the view. This data is not in a grid of Infragistics. I want to export this data to Excel.
Currently I have this in my Javascript:
$("#btnExportToExcel").click(function () {
console.log("exporting to Excel"); $.ig.GridExcelExporter.exportGrid("@Model.labortimeReports)", { fileName: "bookreport_" + $('#startDateDatePicker').val() }, { } );
});
I'm trying to pass the list from my model for exporting it to Excel, but is does not work.
Is it possible to export this list to Excel without having to create a grid for this?
Or am I using the wrong version(s)? I'm currently using these:
<!-- Ignite UI Required Combined CSS Files --> <link href="">cdn-na.infragistics.com/.../infragistics.theme.css" rel="stylesheet"> <link href="">cdn-na.infragistics.com/.../infragistics.css" rel="stylesheet">
<!--Required scripts--> <script src="">igniteui.com/.../script> <script src="">code.jquery.com/.../script> <script src="">code.jquery.com/.../script>
<!-- External files for exporting --> <script src="">www.igniteui.com/.../script> <script src="">www.igniteui.com/.../script>
<script type="text/javascript" src="">cdn-na.infragistics.com/.../script> <script type="text/javascript" src="">cdn-na.infragistics.com/.../script> <script type="text/javascript" src="">cdn-na.infragistics.com/.../script> <script type="text/javascript" src="">cdn-na.infragistics.com/.../script> <script type="text/javascript" src="">cdn-na.infragistics.com/.../script> <script type="text/javascript" src="">cdn-na.infragistics.com/.../script>
I also have tried to create an igGrid with this data and hide this. But I still can't export to excel. I get this error:
Hello Rony,
Thank you for contacting the infragistics support.
Yes, you are able to build a custom workbook where you can place your data as you want.
You can see from the example here how you could achieve this.
Thank you for the answer.
In this example, the number of rows are predefined and you already know the content of the columns. Is there a way to provide a list of which you do not know in advance how many records it will contain? And where you can easily fill all rows with the correct data?