1. #1
    Ext User
    Join Date
    Nov 2008
    Posts
    1
    Vote Rating
    0
    Pratik is on a distinguished road

      0  

    Default Export ExtJs Grid to PDF,XLS,WORD etc

    Hi,

    I there any option for directly exporting the client side Grid object with Data and fomatting to PDF,MS-XLS or MS-Word .

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,600
    Vote Rating
    753
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default

    There's this for Excel: http://extjs.com/forum/showthread.ph...ighlight=excel

    For the others you're better off doing it server side.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User
    Join Date
    Jul 2010
    Location
    india Bangalore
    Posts
    84
    Vote Rating
    0
    sagardash is on a distinguished road

      0  

    Default

    How to do it in server side....
    can any one please help me... i need it really ... please

  4. #4
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    403
    Vote Rating
    14
    devtig will become famous soon enough

      0  

    Default

    What server language? php, jscript, vbscript, perl, java?...
    Christiaan Westerbeek @ Devotis
    Contact me for help with Ext JS, Node JS, FireBase, AngularJS and Javascript in general. Email me or find me at AirPair to connect.

  5. #5
    Ext User
    Join Date
    Jul 2010
    Location
    india Bangalore
    Posts
    84
    Vote Rating
    0
    sagardash is on a distinguished road

      0  

    Default

    my server side language is php

  6. #6
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    403
    Vote Rating
    14
    devtig will become famous soon enough

      0  

    Default

    Start in ExtJS by making a form with standardSubmit=true to a blank window using:
    Code:
    var escapeForm=new Ext.form.FormPanel({
        standardSubmit: true,
        renderTo: Ext.getBody(),
        hidden: true, floating: true,
        defaults: {xtype: 'hidden'},
        items: [
            {name: 'variable1',  value: 'value1'},
            {name: 'variable2',  value: 'value2'},
            {name: 'variable3',  value: 'value3'}
        ],
        url: 'modules/tm/export.asp'
    });
    escapeForm.getForm().getEl().dom.target='_blank';
    escapeForm.getForm().submit();
    escapeForm.destroy();
    Then in php make sure you generate headers like:
    Content-Type: application/x-excel
    Content-Disposition: attachment; filename=export.xls

    but for any specifics in generating your file google: php export pdf
    Christiaan Westerbeek @ Devotis
    Contact me for help with Ext JS, Node JS, FireBase, AngularJS and Javascript in general. Email me or find me at AirPair to connect.

  7. #7
    Ext User
    Join Date
    Jul 2010
    Location
    india Bangalore
    Posts
    84
    Vote Rating
    0
    sagardash is on a distinguished road

      0  

    Default

    Thanks devtig for your reply ..

    sorry i couldnot get you ..i am using grid from that i am exporting to excel/csv/pdf .

    can you please explain me little elaborately

    THANKS

  8. #8
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    403
    Vote Rating
    14
    devtig will become famous soon enough

      0  

    Default

    I am referring to a server side solution where the export.php produces sáme data (but in different format) as is produced by the server for the ajax request that fills your grid. So, you make an export button (in the grid's tool bar maybe) and onclick execute my escapeForm code that will call that export.php.

    Alternatively, if you want to export to excel in a client side solution, follow evant's link (second post). Be warned that that solution won't work in all browsers. The server side solution on the other hand will work in all browsers.
    Christiaan Westerbeek @ Devotis
    Contact me for help with Ext JS, Node JS, FireBase, AngularJS and Javascript in general. Email me or find me at AirPair to connect.

  9. #9
    Ext User
    Join Date
    Mar 2009
    Posts
    1
    Vote Rating
    0
    slaszo is on a distinguished road

      0  

    Default

    Hi,
    I have grid with filter form and server side script (e.g. script1.php).
    Filter and sort parameters are passed to this script using POST (data store, http proxy, remoteSort: true, ...)
    So far it's easy.
    I need to deliver export functionality (csv or/and pdf) but i want to export only filtered data.
    I put export button with link to the second script...
    But how to send filter parameters to second script (e.g. script2.php)?
    DataStore is coupled only with first script.

    I tried to find something, but with no results.

    I will be grateful if someone can help.

    Best Regards

  10. #10
    Sencha User
    Join Date
    Aug 2013
    Posts
    1
    Vote Rating
    0
    smallcode is on a distinguished road

      0  

    Default php solution

    when you redirect to script2.php, you can send filtering parameters via javascript and hidden field(s). your data source in script2.php will be identical to script1.php but you must concatenate ' AND $filtering_string ' to your 'where' part of script1.php's sql command .