今天做项目做了个上传的功能,不过遇到好多问题,先在这做个笔记。。。。
先引入
<link rel="stylesheet" type="text/css" href="<%=path %>/css/ext-all.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="<%=path %>/js/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="<%=path %>/js/ext-all.js"></script>
<script type="text/javascript" src="<%=path %>/js/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=path %>/js/UploadDialog/Ext.ux.UploadDialog.js"></script>
<script type="text/javascript" src="<%=path %>/js/UploadDialog/Ext.ux.UploadDialog.packed.js"></script>
Ext代码:
/**
* 文件上传
*/
function insertImages()
{
var editId=Ext.getCmp('queId').getValue();
//alert('../files.do?method=addFile&type=ntc&tmpId='+useId+'&isupdate='+isupdate+'&editId='+editId);
dialog = new Ext.ux.UploadDialog.Dialog({
title: '文件上传',
url:paths+'/files.do?method=addFile&type=que&tmpId='+useId+'&isupdate='+isupdate+'&editId='+editId,
width : 450,
height : 300,
minWidth : 450,
minHeight : 300,
draggable : true,
resizable : true,
//autoCreate: true,
constraintoviewport: true,
permitted_extensions:['ZIP','zip','DOC','doc','XLS','xls','TXT','txt','RAR','rar','JPG','jpg','GIF','gif','PNG','png'],
modal: true,
//post_var_name: 'mms',
post_var_name: 'upload',
reset_on_hide: false,
allow_close_on_upload: true, //关闭上传窗口是否仍然上传文件
upload_autostart: true
});
dialog.show();//'show-button'
dialog.on('uploadsuccess', onUploadSuccess);
}
function onUploadSuccess(dialog, filename, resp_data, record){
var queId='';
if(isupdate==1)
queId=useId;
if(isupdate==2)
queId=Ext.getCmp('queId').getValue();
fileDs.load({
params: {
findId: queId,
type:'que',
isupdate:isupdate
}
});
}
Ext.ux.UploadDialog中的其它事件函数[转载自http://wayfoon.iteye.com/blog/432541]
* filetest - fires before file is added into the queue, parameters:
dialog - reference to dialog
filename - file name
If handler returns false then file will not be queued.
* fileadd - fires when file is added into the queue, parameters:
dialog - reference to dialog
filename - file name
* fileremove - fires when file is removed from the queue, parameters:
dialog - reference to dialog
filename - file name
record - file record
* resetqueue - fires when upload queue is resetted, parameters:
dialog - reference to dialog
* beforefileuploadstart - fires when file as about to start uploading:
dialog - reference to dialog
filename - uploaded file name
record - file record
If handler returns false then file upload will be canceled.
* fileuploadstart - fires when file has started uploading:
dialog - reference to dialog
filename - uploaded file name
record - file record
* uploadsuccess - fires when file is successfuly uploaded, parameters:
dialog - reference to dialog
filename - uploaded file name
data - js-object builded from json-data returned from upload handler response.
record - file record
* uploaderror - fires when file upload error occured, parameters:
dialog - reference to dialog
filename - uploaded file name
data - js-object builded from json-data returned from upload handler response.
record - file record
* uploadfailed - fires when file upload failed, parameters:
dialog - reference to dialog
filename - failed file name
record - file record
* uploadcanceled - fires when file upload canceled, parameters:
dialog - reference to dialog
filename - failed file name
record - file record
* uploadstart - fires when upload process starts, parameters:
dialog - reference to dialog
* uploadstop - fires when upload process stops, parameters:
dialog - reference to dialog
* uploadcomplete - fires when upload process complete (no files to upload left), parameters:
dialog - reference to dialog
分享到:
相关推荐
The class is ready for i18n, override the Ext.ux.UploadDialog.Dialog.prototype.i18n object with your language strings, or just pass i18n object in config. Server side handler. The files in the queue...
ext.ux.uploadDialog实例
在做文件上传的时候,发现了Ext.ux.UploadDialog这个强大的东西,实现了一下
工程文件 博文链接:https://mutongwu.iteye.com/blog/693692
Sencha Ext JS的文件上传小部件 特征 灵活且易于集成 ... 允许一次选择和上传多个文件 支持原始 PUT/POST 上传和分段上传 您可以轻松编写和集成自己的上传机制,同时保留所有(或大... var dialog = Ext.create('Ext.ux.up
Ext.ux.dialog Common-fileupload 整合版! <br>Ext文件上传完整包
EasyExt_003_第一个组件Ext.Window EasyExt_003_第一个组件Ext.Window
jQuery.dialog.js插件实现漂亮的轻量级对话框效果,多种样式jQuery网页弹出对话框美化特效。
jquery.dialog.js 是jquery 最经典的弹出框插件,简单易用,亲测可用,附案例代码
art.dialog相关的js文件,导入即可使用,内含四个js文件,artDialog.js,iframeTools.js,以及他们的压缩版本(生成环境使用).
里面是经过修改的jquery.ui.dialog.js(版本jQuery UI Dialog 1.8.12),添加了parentElement: 'body',详情查看http://forum.jquery.com/topic/dialog-will-move-its-div-tag-to-body
F7Dialog.min.js ①设置DIV ;"> ;">X 加载中。。。</h2> ②开:Dialog({id:'showBlockDiv', lock:true}); ③关:Dialog.close("showBlockDiv");
打开时修改为以下内容 if (op.mask) { //修改所有对话框zIndex,900为覆盖层,要显示的对话框大于900,不显示的小于900 ... if ($(dialog).data("id")) $.taskBar.closeDialog($(dialog).data("id")); }
bootstrap的dialog.js、bootstrap的dialog.js、bootstrap的dialog.js
android安卓app已经放弃使用Theme.Dialog,改用Theme.Holo.DialogWhenLarge
js Dialog 最新版 绝对强大 js Dialog 兼容主流浏览器ff ie6/ie7/ie8 /opera ..
jquery.dialogBox.js动画对话框插件是一款适合初学者学习的简单网页对话框代码,提供9种不同类型的对话框效果。
dialog.js 前端JavaScript,简易的弹窗插件 用于弹出自定义的弹窗,内部对于常见的滚动穿透,输入法遮挡输入框都有相应的处理。 精简小巧,压缩后仅有5k.
jquery的插件,实现用javascript实现alert,prompt,confirm的效果。