Removing files from the upload list
In this task we'll add the event handlers that will make the Remove and Remove all links in the new file list work. We can attach the event handlers in the same place that we added other event handlers earlier to keep things organized.
Engage Thrusters
In upload.js
, within the widget's init()
method and directly after the existing calls to jQuery's on()
method, add the following new code:
widget.el.on("click", "td a", function(e) { var removeAll = function() { widget.el.find("table").remove(); widget.el.find("input[type='file']").val(""); widget.fileList = []; } if (e.originalEvent.target.className == "up-remove-all") { removeAll(); } else { var link = $(this), removed, filename = link.closest("tr") .children() .eq(1) .text(); link.closest("tr").remove...