Is there any way to programmatically check if an upload widget has been initialized?
I've got a bit of an odd situation, where the same child upload can be associated with multiple parents on the page and I'm trying to set the file list on page load. Since the child exists twice, the (single) file is being displayed twice on each of the two widgets.
I'm using a class to target the children items to add an upload, since they have the same ID:
<
input
class
=
"upload-#= data.Items[i].ID #"
type
=
"file"
/>
Then when I init the upload, I'm creating a files array:
for
(
var
i = 0; i < data.Items.length; i++) {
var
files = [];
for
(
var
a = 0; a < data.Items[i].Attachments.length; a++) {
files.push({
name: data.Items[i].Attachments[a].Name,
size: data.Items[i].Attachments[a].Size,
extension: data.Items[i].Attachments[a].Extension
});
}
$(
'.rcr-upload-'
+ data.Items[i].ID).kendoUpload({
multiple:
true
,
async: {
saveUrl:
"/controllers/UploadController.cfc?method=upload"
,
autoUpload:
true
},
files: files
});
}
When I console.log the files array, it only has the one item in it, so it looks like the duplication is happening because the inputs have the same class (which again, is because the ID is the same). There's no unique ID I can provide for these items, so I'm hoping to check if the widget has been init'd instead.