EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: cdtuql on April 10, 2017, 09:59:19 PM



Title: how to use dialog to download the excel ?
Post by: cdtuql on April 10, 2017, 09:59:19 PM
        var d= $("<div />").dialog({
           width:600,
           height:300,
           modal:true,
           href:'${pageContext.request.contextPath}/fuelnozzleFlowrecorder/getExcel',
           title:'下载Excel',
           method:'GET',
           queryParams:data,
           buttons:[
               {text:'保存',iconCls:'icon-save',plain:true,handler:function(){
                $('#BaseInfo_gasdispensereditform_form').form('submit', {
            url:'${pageContext.request.contextPath}/gasdispenser/addGasdispenser',
            success : function(r) {
                     var obj = jQuery.parseJSON(r);                     
                     if (obj.success) {
                        d.dialog('close');                        
                        $('#BaseInfo_Gasdispenser_datagrid').datagrid('insertRow',{
                           index:0,
                           row:obj.obj
                        });
                        
                     }
                     $.messager.show({
                        title : '提示',
                        msg : obj.msg
                     });
                  }
               });
   
       
           }},{text:'取消',iconCls:'icon-cancel',plain:true,handler:function(){
                       d.dialog('close');}}],
    onClose:function(){
       $(this).dialog('destroy');
    }
   
    });   
       
  I use the  above code that use the dialog  to download the xls produced by the server ,I get the content that can no't read,did not download the xls file, but the  window.location.href can download the file,because I will send  a lot parameter to server,I do not use window.location.href to donwload the xls file ,how can i do