2017-02-23 16 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

私はこれを既に解決したことを忘れてしまった。あなたはこれが解決策であることは間違いありません。 –

関連する問題