Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Check if Upload Initialized

$
0
0

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:

<inputclass="upload-#= data.Items[i].ID #"type="file"/>

Then when I init the upload, I'm creating a files array:

for(vari = 0; i < data.Items.length; i++) {      
    varfiles = [];
                     
    for(vara = 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.


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>