手动执行 jQuery Upload 的 UI 部分
我已经可以使用 jQuery 文件上传 上传文件,但我正在尝试我自己做 UI 部分有两个原因:
- 我想要的外观与 jQuery UI 完全不同,
- 以便更多地了解这个插件的内部结构
我的问题是我似乎无法弄清楚在文件之后完成以下操作所需的流程被删除:
- 在 initUpload 上,为每个文件附加一个列表项
- onProgress,在其各自的列表项 onLoad 中显示文件上传的进度
- ,将列表项的文本更改为“完成”
我已经弄清楚如何正确执行 1:
initUpload: function(event, files, index, xhr, handler, callBack) {
console.log("here, create list item for " + files[index].fileName);
callBack();
return false;
}
我的问题是创建列表项后我不知道如何引用相应的列表项。在 onLoad
或 onProgress
中,当我检查 handler
(或传递给这些函数的其他参数)时,我似乎看不到找到一种方法来引用我想要更新的相应列表项。
如何正确更新每个列表项?
干杯!
I'm able to upload files already with jQuery File Upload, but I'm trying to do the UI part myself for two reasons:
- the look I want is quite different from jQuery UI
- to learn the internals of this plugin a bit more
My problem is I can't seem to figure out the flow needed to complete the following actions after files are dropped:
- on initUpload, append a list item per file
- onProgress, display progress of the file upload in its respective list item
- onLoad, change the list item's text to "Complete"
I've figured out how to do 1 properly:
initUpload: function(event, files, index, xhr, handler, callBack) {
console.log("here, create list item for " + files[index].fileName);
callBack();
return false;
}
My problem is that I don't know how to refer the respective list item after I create the list item. When in either onLoad
or onProgress
, when I inspect handler
(or the other arguments that are passed to those functions), I can't seem to find a way to refer to the respective list item that I want to update.
How do I update each list item properly?
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在处理程序回调之间共享对象:
关于 UI 实现:
Sharing objects between handler callBacks:
Regarding the UI implementation: