【发布时间】:2016-12-09 09:45:23
【问题描述】:
我的剑道网格中有剑道上传控件作为列之一。请在下面的栏目中找到:
$(".files").kendoUpload({
async: {
saveUrl: "/api/test/test/test",
removeUrl: "/api/test/test/test",
autoUpload: true
},
success: onSuccess,
multiple:false,
error: onError,
showFileList: true,
validation: {
allowedExtensions: [".pdf", ".xlsx", ".docx", ".rtf", ".tif",".txt"],MaxFileSize:5242880
}
});
行模板:
template: '<div class="small-12 attachment-wrapper columns"><div class="row"><div class="small-11 columns"><textarea placeholder="Enter notes and descriptions here for claims that have been closed"></textarea></div></div><div class="row"><div class="small-6 attachment columns"><div class="demo-section k-content"><input name="files" class="files" id="files" type="file" /><span class=success></span></div></div></div>'
我正在尝试使用从成功的文件上传获得的结果更新最近的跨度。
function onSuccess(e) {
alert(e.response.FileName);
$(this).closest('span .success').text(e.response.FileName);
}
但我无法找到 span ,它总是说 undefined 。我认为 $(this) 不适用于 kendo controls 。 当我对按钮执行相同的操作时,它确实有效。如何使用 jquery 获取上传控件的上下文和最近跨度。
请对此提出建议
【问题讨论】:
标签: jquery file kendo-ui upload