问题是这样的,我在fineui页面中引用了第三方组件uploadify,并将其置于contentPanel中,uploadify组件有个单独的js文件,我想在选择上传文件完成后使用以下语句更新下contentPanel的高度,以便做到高度随附件的多少伸缩,JS代码片段如下,加粗的部分为我添加的语句:
// Triggered once for each file added to the queue
function onSelect(file) {
if (jQuery.inArray('onSelect',swfuploadify.settings.skipDefault) < 0) {
// Check if a file with the same name exists in the queue
var queuedFile = {};
for (var n in swfuploadify.queue.files) {
queuedFile = swfuploadify.queue.files[n];
if (queuedFile.name == file.name) {
var replaceQueueItem = confirm('The file named "' + file.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?');
if (!replaceQueueItem) {
swfuploadify.cancelUpload(file.id);
swfuploadify.queue.filesCancelled++;
return false;
} else {
jQuery('#' + queuedFile.id).remove();
swfuploadify.cancelUpload(queuedFile.id);
swfuploadify.queue.filesReplaced++;
}
}
}
// Get the size of the file
var fileSize = Math.round(file.size / 1024);
var suffix = 'KB';
if (fileSize > 1000) {
fileSize = Math.round(fileSize / 1000);
suffix = 'MB';
}
var fileSizeParts = fileSize.toString().split('.');
fileSize = fileSizeParts[0];
if (fileSizeParts.length > 1) {
fileSize += '.' + fileSizeParts[1].substr(0,2);
}
fileSize += suffix;
// Truncate the filename if it's too long
var fileName = file.name;
if (fileName.length > 25) {
fileName = fileName.substr(0,25) + '...';
}