Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: How we can have Export Grid data to Excel / PDF

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -7
      -2  

    Default How we can have Export Grid data to Excel / PDF

    Hi
    I am currently using ExtJs 4.1.1 version.

    I have checked all possible ways to find out Export to Excel functionality, but i didn't find the exact solution on this.

    Can you please suggest , Is there any provision to Export the Grid data into Excel , PDF using ExtJs ?
    if yes, Please pass me the correct URL so that I can make my code changes.

  2. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124
    Vote Rating
    93
      -1  

    Default

    Hi Atul,

    See this plugin for Exporting grid data into Excel Sheet -
    http://edspencer.net/2009/11/ext-ux-...el-or-csv.html
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -7
      -2  

    Default

    Thanks for the help.
    I have already gone through this plugin. This was very old one. I thought , currently with Ext 4.1.2 , if we have some Good plugin with more fetures .

    Please suggest , is this the only way to Export to excel ?

  4. #4
    Sencha User
    Join Date
    Mar 2010
    Posts
    249
    Answers
    2
    Vote Rating
    3
      -1  

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -7
      -1  

    Default

    I have checked this , here I guess they are using Ext 3 , which is very old version.

    Is there any plugin which is using Extjs 4 and above ?

    also plz give me some hit so that i will try to develop it at my end.

  6. #6
    Sencha User
    Join Date
    Mar 2010
    Posts
    249
    Answers
    2
    Vote Rating
    3
      -1  

    Default

    Quote Originally Posted by AtulDawkhare View Post
    I have checked this , here I guess they are using Ext 3 , which is very old version.
    You are wrong.

  7. #7
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -7
      -1  

    Default

    Can you please correct me ?

    I have downloaded from

    http://edspencer.net/2009/11/ext-ux-exporter-export-any-grid-to-excel-or-csv.html

    and here I found that they are using Ext 3.0.0

    Also I want to export to PDF as well.

    Please correct me if I missed anything here.

  8. #8

  9. #9
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -7
      -1  

    Default

    ok , thanks for the correction .

    Let me check this by implementing it.
    also
    1] Is it work for PDF as well ?

  10. #10
    Sencha User
    Join Date
    Jun 2011
    Posts
    25
    Vote Rating
    0
      -1  

    Default

    I have try the example.There are something wrong "c is not a constructor".The Ext.ux.exporter.Button is not right.Can you correct it?
    Code:
    /**
     * @class Ext.ux.Exporter.Button
     * @extends Ext.Component
     * @author Nige White, with modifications from Ed Spencer, with modifications from iwiznia.
     * Specialised Button class that allows downloading of data via data: urls.
     * Internally, this is just a link.
     * Pass it either an Ext.Component subclass with a 'store' property, or just a store or nothing and it will try to grab the first parent of this button that is a grid or tree panel:
     * new Ext.ux.Exporter.Button({component: someGrid});
     * new Ext.ux.Exporter.Button({store: someStore});
     * @cfg {Ext.Component} component The component the store is bound to
     * @cfg {Ext.data.Store} store The store to export (alternatively, pass a component with a getStore method)
     */
    Ext.define("Ext.ux.exporter.Button", {
        extend: "Ext.Component",
        alias: "widget.exporterbutton",
        html: '<p></p>',
        config: {
            swfPath: '/flash/downloadify.swf',
            downloadImage: '/images/ext_reports/download.png',
            width: 62,
            height: 22,
            downloadName: "download"
        },
    
        constructor: function(config) {
          config = config || {};
    
          this.initConfig();
          Ext.ux.exporter.Button.superclass.constructor.call(this, config);
    
          var self = this;
          this.on("afterrender", function() { // We wait for the combo to be rendered, so we can look up to grab the component containing it
              self.setComponent(self.store || self.component || self.up("gridpanel") || self.up("treepanel"), config);
          });
        },
    
        setComponent: function(component, config) {
            this.component = component;
            this.store = !component.is ? component : component.getStore(); // only components or stores, if it doesn't respond to is method, it's a store
            this.setDownloadify(config);
        },
    
        setDownloadify: function(config) {
            var self = this;
            Downloadify.create(this.el.down('p').id,{
                filename: function() {
                  return self.getDownloadName() + "." + Ext.ux.exporter.Exporter.getFormatterByName(self.formatter).extension;
                },
                data: function() {
                  return Ext.ux.exporter.Exporter.exportAny(self.component, self.formatter, config);
                },
                transparent: false,
                swf: this.getSwfPath(),
                downloadImage: this.getDownloadImage(),
                width: this.getWidth(),
                height: this.getHeight(),
                transparent: true,
                append: false
            });
        }
    });

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •