2017-02-23 3 views
1

있는 jqGrid의 내용을 내보낼 시도 할 때마다, 그것은 실패하고이 오류 표시 : ASP.NET을 사용하여 구축 된 웹 API에서 내 그리드에서JqGrid exportToExcel을 (를) 수정하는 방법 잘못된 XML 오류?

Uncaught Error: Invalid XML: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http:?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships> 
at Function.error (jquery-1.10.2.js:530) 
at Function.parseXML (jquery-1.10.2.js:610) 
at HTMLTableElement.<anonymous> (jquery.jqGrid.min.js:1513) 
at Function.each (jquery-1.10.2.js:671) 
at init.each (jquery-1.10.2.js:280) 
at init.exportToExcel (jquery.jqGrid.min.js:1483) 
at init.$.fn.jqGrid (jquery.jqGrid.min.js:101) 
at <anonymous>:1:22 

데이터를 다음은

MVC5 내 그리드의 코드이며 내 수출 버튼 :

$('#myGrid').jqGrid({ 
 
     url: '/api/Remittance/GetRemittance', 
 
     mtype: 'GET', 
 
     datatype: 'json', 
 
     styleUI: 'Bootstrap', 
 
     colModel: [ 
 
      { key: true, hidden: true, label: 'Id', name: 'Id', width: 300 }, 
 
      { label: 'System Source', name: 'System_Source', width: 150 }, 
 
      { label: 'Placement Ref', name: 'Placement_Ref', width: 200 }, 
 
      { label: 'Transmittal Date', name: 'Transmittal_Date', width: 150, formatter: 'date', formatoptions: { newformat: 'm/d/Y' } }, 
 
      { label: 'Transmittal Reference', name: 'Transmittal_Reference', width: 200 }, 
 
      { label: 'Transmittal Notes', name: 'Transmittal_Notes', width: 200 }, 
 
      { label: 'Doc Transaction Id', name: 'Doc_Transaction_Id', width: 150 }, 
 
      { label: 'Doc Transaction Type', name: 'Doc_Transaction_Type', width: 170 }, 
 
      { label: 'Doc Status', name: 'Doc_Status', width: 150 }, 
 
      { label: 'Doc Date', name: 'Doc_Date', width: 150, formatter: 'date', formatoptions: { newformat: 'm/d/Y' } }, 
 
      { label: 'Doc Reference', name: 'Doc_Reference', width: 200 }, 
 
      { label: 'Doc Order Reference', name: 'Doc_Order_Reference', width: 200 }, 
 
      { label: 'Doc From', name: 'Doc_From', width: 200 }, 
 
      { label: 'Doc To', name: 'Doc_To', width: 200 }, 
 
      { label: 'Doc Sales Representative', name: 'Doc_Sales_Representative', width: 200 }, 
 
      { label: 'Doc Sales/Supply Unit', name: 'Doc_Sales_Supply_Unit', width: 200 }, 
 
      { label: 'Doc Amount', name: 'Doc_Amount', width: 150, formatter: 'currency', formatoptions: { decimalSeparator: '.', thousandsSeparator: ',', decimalPlaces: 2 } }, 
 
      { label: 'Doc Deductions', name: 'Doc_Deductions', width: 150, formatter: 'currency', formatoptions: { decimalSeparator: '.', thousandsSeparator: ',', decimalPlaces: 2 } }, 
 
      { label: 'Doc Gross Amount', name: 'Doc_Gross_Amount', width: 150, formatter: 'currency', formatoptions: { decimalSeparator: '.', thousandsSeparator: ',', decimalPlaces: 2 } } 
 
     ], 
 
     autoWidth: false, 
 
     shrinkToFit: false, 
 
     viewrecords: true, 
 
     emptyrecords: 'No records to display.', 
 
     width: $(this).parent().width(), 
 
     height: 375, 
 
     rowNum: 10, 
 
     pager: '#pagerGrid', 
 
     jsonReader: { 
 
      root: 'rows', 
 
      page: 'page', 
 
      total: 'total', 
 
      records: 'records', 
 
      Id: '0' 
 
     } 
 
     
 
     $('#exportGrid').click(function() { 
 
     var today = new Date(); 
 
     var dd = today.getDate(); 
 
     var mm = today.getMonth() + 1; 
 
     var yyyy = today.getFullYear(); 
 

 
     $('#myGrid').jqGrid('exportToExcel', { 
 
      includeLabels: true, 
 
      includeGroupHeader: true, 
 
      includeFooter: true, 
 
      fileName: 'Remittance_' + mm + '-' + dd + '-' + yyyy + '.xlsx', 
 
      maxlength: 40 
 
     }); 
 
    });

답변

0

(최소 버전 제외) jquery.jqGrid.js 만 사용하십시오. 그것은 작동해야합니다. 내 것도 똑같은 문제가 있습니다. 이제 작동합니다

+0

나는 이것을 이미 잊었습니다. 당신이 바로 이것이 해결책이라는 것입니다. –