Export to Excel is not working in DataTable

Export to Excel is not working in DataTable

pvuserpvuser Posts: 3Questions: 1Answers: 0
edited May 2017 in Free community support
$("#btnsubmit").click(function () {
          if ($.fn.DataTable.isDataTable("#mytestreport")) {
              $('#mytestreport').DataTable().clear().destroy();
          }
           var obj1 = { teamid: $('#TeamList').val(), teamcategoryid: $('#TeamCategoryList').val() };
           $('#mytestreport').DataTable({  
                    "processing": false,
                    "serverSide": false,
                    "ajax":
                        {
                            "type": "POST",
                            "contentType": "application/json; charset=utf-8",
                            "url": "MyTeamReport.aspx/GetReportbyId",
                            "dataSrc": "d",
                            "data": function (d) {
                                return JSON.stringify(obj1);
                            },                         
                            "dataType": 'json',
                            "paging": true,
                            "lengthChange": false,
                            "searching": true,
                            "ordering": true,
                            "info": true,
                            "autoWidth": false
                        },
                        "aoColumns": [
                        { "data": "TestCreatedDate", "title": "TestCreated Date" },
                        { "data": "TestName", "title": "Test Name" },
                        { "data": "EmployeeCode", "title": "Employee ID" },
                        { "data": "EmployeeName", "title": "Employee Name" },
                        { "data": "Desgination", "title": "Desgination" },
                        { "data": "TotalMark", "title": "TotalMark" },
                        { "data": "ScordMark", "title": "Score" },
                        { "data": "Result", "title": "Pass/Fail" },
                        { "data": "TestAttenddate", "title": "TestAttend Date" },
                        { "data": "TestAssignby", "title": "Test Assignby" },
                        ],
                       
                });              
                return false;
            });

used the below options:

1.

 "oTableTools": {
                        "aButtons": [
                        {
                            'sExtends':'csv',
                            "sFileName": "subscribers.csv",
                            'mColumns':[0,1]
                        }                       
                        ]
                    },
                    "sDom": '<"H"Tlfr>tip<"F">', 

Please help for the above issue

Answers

This discussion has been closed.