• <legend id='vBDkl'><style id='vBDkl'><dir id='vBDkl'><q id='vBDkl'></q></dir></style></legend>
    <tfoot id='vBDkl'></tfoot>
  • <i id='vBDkl'><tr id='vBDkl'><dt id='vBDkl'><q id='vBDkl'><span id='vBDkl'><b id='vBDkl'><form id='vBDkl'><ins id='vBDkl'></ins><ul id='vBDkl'></ul><sub id='vBDkl'></sub></form><legend id='vBDkl'></legend><bdo id='vBDkl'><pre id='vBDkl'><center id='vBDkl'></center></pre></bdo></b><th id='vBDkl'></th></span></q></dt></tr></i><div id='vBDkl'><tfoot id='vBDkl'></tfoot><dl id='vBDkl'><fieldset id='vBDkl'></fieldset></dl></div>
  • <small id='vBDkl'></small><noframes id='vBDkl'>

      <bdo id='vBDkl'></bdo><ul id='vBDkl'></ul>

      1. 将 dojo 数据网格导出到 CSV 文件

        时间:2023-09-07
          <tbody id='goc8r'></tbody>

        <small id='goc8r'></small><noframes id='goc8r'>

      2. <tfoot id='goc8r'></tfoot>
        <legend id='goc8r'><style id='goc8r'><dir id='goc8r'><q id='goc8r'></q></dir></style></legend>

              <i id='goc8r'><tr id='goc8r'><dt id='goc8r'><q id='goc8r'><span id='goc8r'><b id='goc8r'><form id='goc8r'><ins id='goc8r'></ins><ul id='goc8r'></ul><sub id='goc8r'></sub></form><legend id='goc8r'></legend><bdo id='goc8r'><pre id='goc8r'><center id='goc8r'></center></pre></bdo></b><th id='goc8r'></th></span></q></dt></tr></i><div id='goc8r'><tfoot id='goc8r'></tfoot><dl id='goc8r'><fieldset id='goc8r'></fieldset></dl></div>
                <bdo id='goc8r'></bdo><ul id='goc8r'></ul>
                1. 本文介绍了将 dojo 数据网格导出到 CSV 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一个 Javascript 函数,它将我的数据网格 (zero.grid.DataGrid) 中的数据导出到一个 CSV 文件或可以由电子表格应用程序打开的类似文件中.

                  I am looking to get a Javascript function which will export my datagrid (zero.grid.DataGrid) full of data into a CSV file or something similar which can be opened by a spreadsheet application.

                  有没有标准的方法可以做到这一点..

                  Is there any standard way of doing this out there..

                  推荐答案

                  我很难将 Exporter 插件与 EnhancedGrid 一起使用,并使用 servlet 作为后端.最后我使用 iFrame 使它工作:

                  I had tough time with using Exporter plugin with EnhancedGrid using servlet as backend. Finally I made it work by using iFrame:

                  <!DOCTYPE HTML>
                  <html lang="en">
                     <head>
                      <meta charset="utf-8">
                      <title>CISROMM - Master Milestone List Editor</title>
                      <!-- Include dojo dependencies -->
                      <link rel="stylesheet" href="js/dojoroot/dojo/resources/dojo.css">
                      <link rel="stylesheet" href="js/dojoroot/dijit/themes/claro/claro.css">
                      <link rel="stylesheet" href="js/dojoroot/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css">
                      <link rel="stylesheet" href="js/dojoroot/dojox/grid/enhanced/resources/EnhancedGrid.css">
                      <link rel="stylesheet" href="js/dojoroot/dojox/grid/resources/claroGrid.css">
                      <script src="js/dojoroot/dojo/dojo.js"
                          data-dojo-config="isDebug: true,parseOnLoad: true">
                      </script>
                      <!-- Include dojo dependencies -->
                  
                      <!-- Require the widgets -->
                      <script>
                          dojo.require("dojox.grid.EnhancedGrid");
                          dojo.require("dojo.data.ItemFileWriteStore");
                          dojo.require("dojox.grid.enhanced.plugins.exporter.CSVWriter");
                                  dojo.require("dojo.io.iframe");
                      <!-- Require the widgets -->                 
                  
                      <!-- Data Export Handler -->
                          function exportAll(){
                              dijit.byId("grid").exportGrid("csv", function(str){
                                      dojo.io.iframe.create('exportFrame', 'exportFrameLoaded()', '');
                                      dojo.io.iframe._currentDfd = null;
                                      dojo.io.iframe.send({
                                              url: "/ExportGrid.json",
                                              content:{data:str}
                                      });
                                  });
                          };
                      <!-- Data Export Handler -->
                  
                      var grid, store;
                      <!-- Grid Creation -->
                      dojo.ready(function(){
                  
                          store = new dojo.data.ItemFileWriteStore({ url: 'PopulateMsListEditor.json', urlPreventCache: 'yes', clearOnClose: 'yes'    });
                  
                          grid = new dojox.grid.EnhancedGrid({
                              store: store,
                              rowSelector: 'auto',
                              query: {id: "*"} ,
                              plugins: {
                                    exporter: true
                              },
                              structure: [
                                    {field: 'msConstId', width: '20%', name: 'Milestone',hidden: true},
                                                {field: 'name', width: '20%', name: 'Milestone',editable: true}
                              ]
                          },"grid");
                  
                          grid.startup();
                  
                      });
                      </script>
                  
                     </head>
                     <body class="claro">
                      <button id="exportBtn" data-dojo-type="dijit.form.Button"
                              data-dojo-props="
                                  iconClass:'dijitIconFile',
                                  showLabel:true,
                                  onClick:function() {
                                      exportAll();
                                  }">
                                  Export to Excel
                      </button>
                  
                      <div id="grid" style="width: 560px;height: 680px;"></div>
                  
                     </body>
                  </html>
                  

                  我写了一篇博文,这样我就不必再搜索了.

                  I have written a blog post so that I don't have to search again.

                  从 Dojo 中的网格导出数据

                  PS:建议仅将 iFrame 用于内部/内部 Web 应用程序.

                  PS: It is recommended to use iFrame only for internal/in-house web applications.

                  这篇关于将 dojo 数据网格导出到 CSV 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:与 Rails 一起使用的最佳 JavaScript 库? 下一篇:呈现后以编程方式应用 jquery (mobile) css 类

                  相关文章

                  1. <legend id='uJLiZ'><style id='uJLiZ'><dir id='uJLiZ'><q id='uJLiZ'></q></dir></style></legend>
                  2. <small id='uJLiZ'></small><noframes id='uJLiZ'>

                      <tfoot id='uJLiZ'></tfoot>
                        <bdo id='uJLiZ'></bdo><ul id='uJLiZ'></ul>
                    1. <i id='uJLiZ'><tr id='uJLiZ'><dt id='uJLiZ'><q id='uJLiZ'><span id='uJLiZ'><b id='uJLiZ'><form id='uJLiZ'><ins id='uJLiZ'></ins><ul id='uJLiZ'></ul><sub id='uJLiZ'></sub></form><legend id='uJLiZ'></legend><bdo id='uJLiZ'><pre id='uJLiZ'><center id='uJLiZ'></center></pre></bdo></b><th id='uJLiZ'></th></span></q></dt></tr></i><div id='uJLiZ'><tfoot id='uJLiZ'></tfoot><dl id='uJLiZ'><fieldset id='uJLiZ'></fieldset></dl></div>