1. #11
    Sencha User keypoint's Avatar
    Join Date
    Oct 2007
    Location
    Bucharest, Romania
    Posts
    69
    Vote Rating
    1
    keypoint is on a distinguished road

      0  

    Default


    devnull, do you have a form to provide as the form argument? If you don't it will not work. For example if you only have a grid and you need an export button somewhere. If that is the case, add a hidden form element and provide that as the argument. Here's a sample for a formless attachment request:

    PHP Code:
    function getTbExcel() {
            if (!
    Ext.fly('tbExcel')) {
                return {
                    
    xtype'tbbutton',
                    
    id'tbExcel',
                    
    text'Excel',
                    
    cls'x-btn-text-icon',
                    
    icon'images/icons/excel-s.gif',
                    
    handler: function() {
                        
    //create dummy form
                        
    if (!Ext.fly('frmDummy')) {
                            var 
    frm document.createElement('form');
                            
    frm.id 'frmDummy';
                            
    frm.name id;
                            
    frm.className 'x-hidden';
                            
    document.body.appendChild(frm);
                        }
                    
                        
    //get attachment
                        
    Ext.Ajax.request({
                            
    url'reports/loadexcel',
                            
    formExt.fly('frmDummy'),
                            
    isUploadtrue
                        
    });
                    }
                };
            } else {
                return 
    Ext.getCmp('tbExcel');
            }
        } 
    This is a function I use to get my excel export button. See the part with the form creation and ajax request. If you do have a form in the page, you don't need that part. Just say form: myFormPanel.getForm().el and you're done

    By the way, Animal, how do you feel about this approach for creating/using fields? It's pretty close to the Java getter thing

  2. #12
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    45
    Vote Rating
    1
    fshort is on a distinguished road

      0  

    Default export progress

    export progress


    Hi,
    Off of this, lets say at the time the user clicks the export button I show a progress dialog while the data is being fetched from the server. When the request completes and the file dialog pops up, will Ext.Ajax.request detect the fact the request completed, invoke the callback function, so I can and close the progress dialog?

    Thanks,
    Fred

  3. #13
    Ext User Shmoo's Avatar
    Join Date
    Sep 2007
    Posts
    41
    Vote Rating
    0
    Shmoo is on a distinguished road

      0  

    Default


    Hi,

    I am also doing something similar, but in my case, I use Java in my server side.

    My problem is quite strange, after viewing the grid, and clicking a button to save as a csv file, it goes back to the server, makes a csv file there, then returns to me the url to that file.

    Firefox shows the "save file as" dialog but the "Ok" button is disabled. In IE7, nothing happens when I click the button.

    I am just doing

    var filewin = window.open('$File_path_url');

    at my client-side script.

    Any ideas what went wrong?

  4. #14
    Ext User tonedeaf's Avatar
    Join Date
    Dec 2007
    Posts
    137
    Vote Rating
    1
    tonedeaf is on a distinguished road

      0  

    Default


    Quote Originally Posted by fshort View Post
    Hi,
    Off of this, lets say at the time the user clicks the export button I show a progress dialog while the data is being fetched from the server. When the request completes and the file dialog pops up, will Ext.Ajax.request detect the fact the request completed, invoke the callback function, so I can and close the progress dialog?

    Thanks,
    Fred
    Firefox invokes the callback function after the AJAX request, but IE6 doesn't (haven't checked with IE7).

    I'm displaying the grid loadMask (GridPanel.loadMask.show()) and when the request completes, I hide it in the callback function.

    Firefox invokes the callback function, hides the loadMask and shows the save dialog. IE6 doesn't invoke the callback function and shows the save dialog directly, the loadMask stays on and the callback is never invoked.

    Same would apply to your progress dialog. One workaround is not to show any progress dialog, but for long operations, the user might need some feedback.

    Can anyone help in resolving this situation for IE ?

  5. #15
    Ext User
    Join Date
    May 2008
    Posts
    30
    Vote Rating
    0
    descheret is on a distinguished road

      0  

    Cool no "save as" window pops up in IE6

    no "save as" window pops up in IE6


    hello,

    my problem is similar - I have a grid, select some downloads with the checkbox model, click a button and a "save as" window should pop up. works perfect in IE7 and FF but not in IE6. Is there anyone who can help me

    I'm using the following scripts and Ext 2.2:

    Javascript:
    Code:
    /*
    # there is a grid with the checkboxselection model, from the selected rows I create a
    # json "array" with the download ids (strParams) - these go to the action handle 
    # which looks for the right files, group and zip them and open a zip save as dialoge
    */
    
    if (!Ext.fly('frmDummy')) {
                            var frm = document.createElement('form');
                            frm.id = 'frmDummy';
                            frm.name = id;
                            frm.className = 'x-hidden';
                            document.body.appendChild(frm);
                        }
                        Ext.Ajax.request({
                            url: 'action.php',
                            method : 'POST',
                            form: Ext.fly('frmDummy'),
                            callback: function(o, s, r){
                                //alert(r.responseText);
                            },
                            isUpload: true,
                            params: { a: action, documents: strParams }
                        });
    all vars are transported very well to the php script (works in ie7 and ff)

    PHP:
    PHP Code:

    // I'm creating an archive here and save it in a temp folder

            
    header("Pragma: public");
            
    header("Expires: 0");
            
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            
    header("Content-Type: application/force-download");
            
    header("Content-Type: application/octet-stream");
            
    header('Content-type: application/zip');
            
    header("Content-Disposition: attachment;filename=" basename($archive));
            
    //header("Content-Transfer-Encoding: binary ");
            
    readfile($archive);
            
            
    unlink($archive);
            exit; 
    thanks a lot
    Ron

  6. #16
    Ext User
    Join Date
    Nov 2008
    Posts
    59
    Vote Rating
    0
    Bandorka is on a distinguished road

      0  

    Default


    Hi,

    Yes it all works, but with the isUpload method in IE, a security warning appears for the download and if you click yes, the whole page reloads and you are back at the beginning...


    Any idea

    B

  7. #17
    Ext User
    Join Date
    Aug 2009
    Posts
    127
    Vote Rating
    0
    rblon is on a distinguished road

      0  

    Default


    Sorry to revive an old thread, but it answered my question "how to save to file" perfectly.

    I have tested the solution by keypoint also in IE 6 and it worked, so I'm not sure why it didn't for the others. Perhaps it has to with security settings that are different on my machine? Descheret, Bandorka, did you find out what was causing the issue you were observing?

  8. #18
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Location
    Dallas, Texas
    Posts
    561
    Vote Rating
    28
    aw1zard2 has a spectacular aura about aw1zard2 has a spectacular aura about

      0  

    Default


    I was looking up something on php.net and found this comment under the header() function. I copied the comment here and made bold text out of the interesting part. And thinking about it does make a lot of sense.

    After lots of research and testing, I'd like to share my findings about my problems with Internet Explorer and file downloads.

    Take a look at this code, which replicates the normal download of a Javascript:
    PHP Code:
    <?php
     
    if(strstr($_SERVER["HTTP_USER_AGENT"],"MSIE")==false) {
      
    header("Content-type: text/javascript");
      
    header("Content-Disposition: inline; filename=\"download.js\"");
      
    header("Content-Length: ".filesize("my-file.js"));
     } else {
      
    header("Content-type: application/force-download");
      
    header("Content-Disposition: attachment; filename=\"download.js\"");
      
    header("Content-Length: ".filesize("my-file.js"));
     }
     
    header("Expires: Fri, 01 Jan 2010 05:00:00 GMT");
     if(
    strstr($_SERVER["HTTP_USER_AGENT"],"MSIE")==false) {
      
    header("Cache-Control: no-cache");
      
    header("Pragma: no-cache");
     }
     include(
    "my-file.js");
    ?>
    Now let me explain:

    I start out by checking for IE, then if not IE, I set Content-type (case-sensitive) to JS and set Content-Disposition (every header is case-sensitive from now on) to inline, because most browsers outside of IE like to display JS inline. (User may change settings). The Content-Length header is required by some browsers to activate download box. Then, if it is IE, the "application/force-download" Content-type is sometimes required to show the download box. Use this if you don't want your PDF to display in the browser (in IE). I use it here to make sure the box opens. Anyway, I set the Content-Disposition to attachment because I already know that the box will appear. Then I have the Content-Length again.

    Now, here's my big point. I have the Cache-Control and Pragma headers sent only if not IE. THESE HEADERS WILL PREVENT DOWNLOAD ON IE!!! Only use the Expires header, after all, it will require the file to be downloaded again the next time. This is not a bug! IE stores downloads in the Temporary Internet Files folder until the download is complete. I know this because once I downloaded a huge file to My Documents, but the Download Dialog box put it in the Temp folder and moved it at the end. Just think about it. If IE requires the file to be downloaded to the Temp folder, setting the Cache-Control and Pragma headers will cause an error!

    I hope this saves someone some time!
    ~Cody G.

  9. #19
    Sencha User
    Join Date
    Nov 2010
    Posts
    12
    Vote Rating
    0
    x10 is on a distinguished road

      0  

    Smile ExtJS 3.3 + Zend Framework + PHPExcel

    ExtJS 3.3 + Zend Framework + PHPExcel


    Thank you friends, this thread saved hours of headache.
    It works for me with ExtJS 3.3 + Zend Framework 1.10 + PHPExcel 1.7.6

    PHP Code:
    Ext.Ajax.request({
        
    url'myUrl',
        
    formmyWindow.myFormPanel.getForm().el,
        
    params: {myParam1},
        
    isUploadtrue
    }); 
    For server side code visit PHPExcel forum
    http://phpexcel.codeplex.com/discussions/250120
    Last edited by x10; 5 Apr 2011 at 5:47 AM. Reason: added version numbers of Zend and PHPExcel

  10. #20
    Sencha User
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    0
    anuragchaturvedi is on a distinguished road

      0  

    Default Missing (doc or xls)

    Missing (doc or xls)


    Hi Guys,

    but when I export to word or Excel then downloaded file does not show extension .doc or xls.

    Regards
    Anurag

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar