2012-10-10 13 views
1

我想在Excel或.xls中導出Ext.Grid,但由於某些原因,它不會在Mac中獲取數據。該文件在Windows中以.xlt格式導出,不會在MS Office Excel中打開。雖然導出的文件在Ubuntu中導出並使用Libre打開時具有所有數據。Ext.ux.Exporter.Button無法使用ExtJS輸出excel數據

我使用的是github中提供的Ext.ux.Exporter。該文件是Exporter-all.js,它可以完成所有工作。我真的很困惑我哪裏錯了?

這是在Excel導出按鈕的代碼,

var grid = new Ext.grid.GridPanel({ 
    title: "Intersected Species Info", 
    store: stor, 
    width: 585, 
    height: 260, 
    stripeRows: true, 
    tbar: [], 
    columns: columns, 
    listeners: { 
     render: function (grid) { 
      grid.getSelectionModel().selectFirstRow(); 
     } 
    } 
}); 

var exportCSV = new Ext.ux.Exporter.Button({ 
    component: grid, 
    text: 'Download CSV' 
}); 

grid.getTopToolbar().add(exportCSV); 

這是我在哪裏進口的js文件,

<script src="../exporter/Exporter-all.js" type="text/javascript"></script>

我在哪裏不正確?

+0

」它不會在Mac中獲取數據「。這是什麼意思?一個空文件?下載的文件有多少個字節?它包含什麼? – Francesco

回答

0

您使用的github存儲庫是ExtJS 3,如果我沒有錯。您可以改用此https://github.com/iwiznia/Ext.ux.Exporter

記得替換Style.js excelFormatter文件夾內,使用this

不好意思扔了一堆的鏈接,但this線程解釋得很好。您也可以按照示例here。 「

+0

問題標有extjs3,所以edspencer回購是正確的。 – Francesco